C# 3.0 Enhancements: Lambda Expression (more on what)

C# 3.0 Enhancements: Lambda Expression (more on what)

  • Comments 0

Lambda Expression gives us the more concise way of Anonymous Method implementation through functional programming language. Let me share some interesting aspects of Lambda Expression while exploring the C# 3.0 Specification. There it is being clearly described what Lambda Expression is.

 

(param) => expr

 

Can be expressed as

 

param => expr

 

Couple of the examples are given there

 

x => x + 1                // Implicitly typed, expression body

x => { return x + 1; }    // Implicitly typed, statement body

(int x) => x + 1                // Explicitly typed, expression body

(int x) => { return x + 1;}// Explicitly typed, statement body

(x, y) => x * y            // Multiple parameters

() => Console.WriteLine()  // No parameters

 

It is very interesting to me. Hope you will also enjoy this.

 

Namoskar!!!

Leave a Comment
  • Please add 4 and 2 and type the answer here:
  • Post