TestDelegateA testDelA = x => { Console.WriteLine(x); };
TestDelegateB testDelB = (x, y) => { Console.WriteLine(x + y.ToString()); };
testDelA("hello word");
testDelB("hello", 123);
List<string> strList=new List<string>();
strList.Add("hello test1");
strList.Add("hello test2");
strList.Add("hello test3");
Action<string> OutPut = str=>Console.WriteLine(str);
//OutPut outPut = Say;
strList.ForEach(OutPut); //list<>这些用委托的貌似只能用action的委托别的不行 //OU = Say1; //strList1.ForEach(OU); Console.WriteLine("这是莱姆达表达树----------------------");
Expression<Func<int, int, int>> expression = (x, y) => x + y;
Func<int, int, int> adddFunc = expression.Compile();
Console.WriteLine(adddFunc(10,20));
详细可参考:http://www.cnblogs.com/kingmoon/archive/2011/05/03/2035696.html
莱姆达表达式树:http://blog.jobbole.com/84588/