// This lambda expression...
List evenNumbers = list.FindAll(i => (i % 2) == 0);
is compiled into the following approximate C# code:
// ...becomes this anonymous method.
List evenNumbers = list.FindAll(delegate (int i)
{
return (i % 2) == 0;
});
Dissecting a Lambda Expression
A lambda expression is written by first defining a parameter list, followed by the => token (C#’s
token for the lambda operator found in the
lambda calculus), followed by a set of statements (or a
single statement) that will process these arguments. From a very high level, a lambda expression
can be understood as follows:
ArgumentsToProcess => StatementsToProcessThem
Within our LambdaExpressionSyntax() method, things break down like so:
Do'stlaringiz bilan baham: |