Lambda basic definition: Parameters => Executed code.
Same example (now execute the lambda):
Simple example
n => n % 2 == 1
- n is the input parameter
- n % 2 == 1 is the expression
Same example (now execute the lambda):
List<int> numbers = new List<int>{11,37,52}; List<int> oddNumbers = numbers.where(n => n % 2 == 1).ToList(); //Now oddNumbers is equal to 11 and 37
No comments:
Post a Comment