LANGUAGE

Statement lambda

Lambda with a block body; value-returning paths must return a compatible result.

Formal Syntax & Structure

csharp syntaxcsharp
parameters => { statements }

Working Example

Example Snippetcsharp
using System;Func<int,int> abs = x => { return x < 0 ? -x : x; };Console.WriteLine(abs(-3));
C# & .NET Reference