Stats

Contributors: 1 Thursday, December 3, 2015
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

Lambdas for both `Func` and `Action`

Download c# eBook

Example

Typically lambdas are used for defining simple functions (generally in the context of a linq expression):

var incremented = myEnumerable.Select(x => x + 1);

Here the return is implicit.

However, it is also possible to pass actions as lambdas:

myObservable.Do(x => Console.WriteLine(x));