标签:style span details write ret 没有 stat chinese str
相关参考:http://blog.csdn.net/jcx5083761/article/details/8552627
1,Delegate的代码
1 public delegate void myDelegate(string str); 2 public static void HellowChinese0(string strChinese) 3 { 4 Console.WriteLine("Good morning," + strChinese); 5 } 6 7 private static void demo0() 8 { 9 myDelegate d = new myDelegate(HellowChinese0); 10 d("demo0"); 11 }
2,Action:指定那些只有输入参数,没有返回值的委托
1 public static void HellowChinese(string strChinese) 2 { 3 Console.WriteLine("Good morning," + strChinese); 4 } 5 6 static void demo1() 7 { 8 Action<string> action = HellowChinese; 9 action("demo1"); 10 }
3,Func:有返回值!
1 public static string HelloEnglish(string strEnglish) 2 { 3 return "Good morning," + strEnglish; 4 } 5 static void demo2() 6 { 7 Func<string, string> f = HelloEnglish; 8 Console.WriteLine(f("demo2")); 9 }
标签:style span details write ret 没有 stat chinese str
原文地址:http://www.cnblogs.com/jimmy-zhang/p/6692259.html