What is a lambda?

A lambda is essentially a method without a declaration; it uses clear and short syntax. A lambda can be written as a shorthand method directly in the place it’s intended to be used. This is especially useful on small methods that are used only once. The lambda operator is =>, and can be read as goes to. The lambda operator separates the expression into two parts (left side parameter, right side lambda body).

Syntax

ANewNumber addFive = x => x + 5;

Example: Lambda using a delegate

Get hands-on with 1400+ tech skills courses.