C#

Lambda 表达式分为三个部分:

1 参数定义部分。参数是未类型化的,因此编译器可以根据上下文推断出他们的类型。

2 =>运算符,把Lambda表达式的参数与表达式体分开。

3 表达式体

delegate int TwoIntegerOperationDelegate(int paramA, int paramB);

static void PerformOperations(TwoIntegerOperationDelegate del)

{

 ...

}

PerformOperations((paramA, paramB) => paramA + paramB);

如果使用匿名方法

PerformOperations(delegate(int paramA, int paramB)

{

 return paramA + paramB;

});

原文地址:https://www.cnblogs.com/lilideng/p/CSharp_Lambda.html