static void Main()
{
//第一步 委托实例调用
Func<string, int> test = new Func<string, int>(getLength); //第二步 匿名方法
Func<string, int> test1 = delegate(string str) {
return str.Length;
}; //第三步 Lamada表达式第一步
Func<string, int> test2 = (string str) =>{ return str.Length; }; //Lamada表达式第二步
Func<string, int> test3 = (string str) => str.Length; //Lamada表达式第三步 省略参数
Func<string, int> test4 = (str) => str.Length; //Lamada表达式第三步 省略参数和括号
Func<string, int> test5 = str => str.Length; int a = test("");
} static int getLength(string str)
{
return str.Length;
}