LANGUAGE

Anonymous method

Anonymous function using delegate syntax, convertible to a compatible delegate.

Formal Syntax & Structure

csharp syntaxcsharp
delegate (T x) { return expression; }

Working Example

Example Snippetcsharp
using System;Func<int,int> plus = delegate(int n) { return n+1; };Console.WriteLine(plus(4));
C# & .NET Reference