A lambda expression is an anonymous function that provides a concise and functional syntax, which is used to write anonymous methods. It is based on the function programming concept and used to create delegates or expression tree types. The syntax is function(arg1, arg2...argn) expression.
Lambda expressions use the operator symbol =, which reads as "goes to." Input parameters are specified on the operator's left side, and statement/expressions are specified on the right. Generally, lambda expressions are not directly used in query syntax but are often used in method calls. Query expressions may contain method calls. Lambda expression syntax features are as follows:
Lambda expressions provide shorthand for the compiler, allowing it to emit methods assigned to delegates. The compiler performs automatic type inference on the lambda arguments, which is a key advantage.
Read More ยป
Get Techopedia delivered to your inbox!