The inclusion of lambda expressions (often termed as lambdas) enhanced the C# programming language. These are powerful alternatives to anonymous methods. C# 2.0 introduced anonymous methods, and C# 3.0 introduced lambda expressions. Nowadays, lambda expressions are more popular than anonymous methods. Why? They are typically a perfect fit for inline declarations, more expressive, and easier to read. You often see lambda expressions while working with delegates, events, and LINQ. Since this pocketbook focuses on delegates and events, this chapter analyzes the uses of lambda expressions in those contexts.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Lambda Expressions

  • Vaskaran Sarcar

摘要

The inclusion of lambda expressions (often termed as lambdas) enhanced the C# programming language. These are powerful alternatives to anonymous methods. C# 2.0 introduced anonymous methods, and C# 3.0 introduced lambda expressions. Nowadays, lambda expressions are more popular than anonymous methods. Why? They are typically a perfect fit for inline declarations, more expressive, and easier to read. You often see lambda expressions while working with delegates, events, and LINQ. Since this pocketbook focuses on delegates and events, this chapter analyzes the uses of lambda expressions in those contexts.