c#怪异的Lambda 语法

Lambda Syntax

其实完全可以看成一种方法

[param list] => expression

method(param list){
   expression
}

看上去是很像
List<string> lastNames = new List<string> { “Einstein”, “Gore”, “Mayo” };
var famousPeople = lastNames.FindAll(lastName => lastName != “Mayo”);
famousPeople.ForEach(lastName => Console.WriteLine(lastName)


小例子

你可能感兴趣的:(C++,c,C#)