C# Lambda ( => ) [duplicate]
Possible Duplicates:
Good tutorials for lambda
Lambda Explanation and what it is as well as a good example
C# Lambda expression, why should I use this?
Can someone explain to me how to use this and give me examples? How do we read it?
Example !=
is read as "not equals to." So =>
means what?
All lambda expressions use the lambda operator =>, which is read as "goes to". The left side of the lambda operator specifies the input parameters (if any) and the right side holds the expression or statement block. The lambda expression x => x * x is read "x goes to x times x." This expression can be assigned to a delegate type as follows:
From the docs
the => operator has the same precedence as assignment (=) and is right-associative.
"=>" is lambda operator and is read as "goes to"
This is the lambda operator. Which means 'goes to'. It is used to create lambda expressions which is syntax offered by C# for anonymous methods.
eg. lamda expression x=>x > 2
. This mean that given x, x goes to x greater than 2. In other words this lambda expression will select x greater than 2.
Anonymous method for the same can be written as
delegate(int x){return x > 2;}
http://msdn.microsoft.com/en-us/library/bb397687.aspx
The => operator has the same precedence as assignment (=) and is right-associative.