A Lambda expressions are a simpler syntax for anonymous delegates and can be used everywhere an anonymous delegate can be used. However, the opposite is not true; lambda expressions can be converted to expression trees which allows for a lot of the magic like LINQ to SQL.
For Example
List<int> elements = new List<int>() { 10, 20, 31, 40 };
int oddIndex = elements.FindIndex(x => x % 2 != 0);</int></int>
Explanation :
x The argument name.
=> Separates argument list from result expression.
x % 2 !=0 Returns true if x is not even.
Second example
var evens = Enumerable
.Range(1, 100)
.Where(delegate(int x) { return (x % 2) == 0; })
.ToList();
var evens = Enumerable
.Range(1, 100)
.Where(x => (x % 2) == 0)
.ToList();
In MVC model => item.FirstName means. Logically it would translate to string Function(Model model) { return item.FirstName; }. Basically this is a function with a parameter, but this parameter is not used.
And now, the last bit of the information. Although lambda expressions represent functions in the end, sometimes they are created not with the purpose of actually being executed (although potentially they can). A lambda expression can be represented in form of an expression tree. This means that instead of executing it it can be parsed.
In this particular case MVC engine does not run the function that the lamba expression represents. Instead the expression is parsed so that MVC engine knows what html to emit for this particular line. If your data item does not come from your model object directly, the left part of the lambda expression does not matter.
For more information, Please see following links
http://msdn.microsoft.com/en-IN/library/bb397687.aspx[
^]
http://www.dotnetperls.com/lambda[
^]
http://stackoverflow.com/questions/167343/c-sharp-lambda-expression-why-should-i-use-this[
^]
Way to Lambda[
^]
http://www.dotnet-tricks.com/Tutorial/csharp/LOUM180612-C-Sharp-Lamda-Expression.html[
^]