Lambda Expression in C# | Angular | ASP.NET Tutorials

For Consultation : +91 9887575540

Stay Connected :

Lambda expression is feature of C# 3.0. A lambda expression is an anonymous function.I can say that lambda expression is a method without declaration, i.e., access modifier, return value declaration, and name. It follows a syntax to create and invoke functions

It’s a shorthcut way to write a method in the same place you are going to use it. Generally useful in places where a method is being used only once and the method definition is short. It saves you the effort of declaring and writing a separate method to the containing class.


Lambda basic definition:  Parameter => executioncode.


n => n % 2 == 0


List<int> numbers = new List<int>{12,31,52};List<int> evenNumbers = numbers.where(n => n % 2 == 0).ToList();//Now evenNumbers is equal to 12 and 52


Download Source Code