Lambda Expressions
A little known gem in C# is the lambda expression. Lambda expression is used to define function delegates. A function delegate is defined as:
public delegate TResult Func<T, TResult>(T arg);
In the above code, Func is a delegate which has a templated argument T and returns TResult.
Lambda expressions are used to define function delegates. For eg, the following code defines a Func delegate as lambda expression. Here, n >0 is a function that returns true if the integer n is positive.
Func<int, bool> Positive = n => n > 0;
Lambda expressions are used a lot in ASP.NET MVC.
Posted by Vijay on 15-Jul-2010 12:12 PM
Category : ASP.NET MVC
Category : ASP.NET MVC


