摘要: class Program { static void Main(string[] args) { PrintAuthorInfo(typeof(FirstClass)); PrintAuthorInfo(typeof(SecoundClass)); PrintAuthorInfo(... 阅读全文
posted @ 2018-05-02 23:52 年糕力仔 阅读(94) 评论(0) 推荐(0)
摘要: class Program { static void Main(string[] args) { //将方法作为参数传递 MyDelegate de = M1; Test(de); //执行test方法后重新调用 de(); ... 阅读全文
posted @ 2018-05-02 06:04 年糕力仔 阅读(130) 评论(0) 推荐(0)
摘要: class Program { static void Main(string[] args) { //定义三个委托变量 MyDelegate d1, d2, d3,d4; //变量关联方法 d1 = TestMethod1; d2 ... 阅读全文
posted @ 2018-05-02 05:30 年糕力仔 阅读(76) 评论(0) 推荐(0)
摘要: //扩展方法可以合并到扩展类型的实例上,因此扩展方法定义为静态类并且第一个参数为扩展当前实例加上this public static class StringExt { public static string SplitBySpace(this string str) { string strRes; ... 阅读全文
posted @ 2018-05-02 05:14 年糕力仔 阅读(74) 评论(0) 推荐(0)
摘要: class Program { static void Main(string[] args) { //调用显示接口 Test t = new Test(); //调用了test1.run方法 ((ITest1)t).Run(); ... 阅读全文
posted @ 2018-05-02 05:01 年糕力仔 阅读(59) 评论(0) 推荐(0)