Test.WriteName w = (string name) => { Console.WriteLine("Hello,{0}!", name); };//使用匿名委托
25: w("Jimmy");
http://www.cnblogs.com/Mainz/archive/2011/03/11/1981201.html
private void App()
3 {
4 XXControl.Invoke(new DoSomething(() =>
5 {
6 //DoSomething的具体操作
7 }));
8 }
这样做可以是可以, 但使用匿名方法则更好, 最起码看上去更简洁.
0 private void App()
1 {
2 XXControl.Invoke(delegate
3 {
4 //DoSomething的具体操作
5 });
6 }