标签:
1.演化
//1 delegate void FunctionPointer(string str); static void Main(string[] args) { FunctionPointer fp = HelloWorld; fp("Hello World"); } static void HelloWorld(string str) { Console.WriteLine(str); Console.ReadLine(); } //2 delegate void FunctionPointer(string str); static void Main(string[] args) { FunctionPointer fp = delegate(string s) { Console.WriteLine(s); Console.ReadLine(); }; fp("Hello World!"); } //3 delegate void FunctionPointer(string str); static void Main(string[] args) { FunctionPointer fp = a => Console.WriteLine(a); fp("Hello World"); Console.ReadLine(); } //4 static void Main(string[] args) { Action<string> fp = s => Console.WriteLine(s); fp("Hello World!"); Console.ReadLine(); }
标签:
原文地址:http://www.cnblogs.com/revoid/p/5668808.html