Lambda Expression
Anatomy of the Lambda Expression
C# 3.0(.NET 3.5) introduced the lambda expression along with LINQ. The lambda expression is a shorter way of representing anonymous method using some special syntax.
For example, following anonymous method checks if student is teenager or not:
The above anonymous method can be represented using a Lambda Expression in C# and VB.Net as below:
Lambda Expression in VB.Net
Let's see how the lambda expression evolved from the following anonymous method.
The Lambda expression evolves from the anonymous method by first removing the delegate keyword and parameter type and adding a lambda operator =>.
Last updated