← All notes

C# delegates and events

Answer: A delegate is a type-safe reference to a method, which lets you pass methods as parameters and chain several together.

Delegates

Func<int, int> square = x => x * x;
Action<string> log = Console.WriteLine;
log += s => Debug.WriteLine(s);   // multicast chain
log("hello");                       // calls both

Events

class Downloader {
  public event EventHandler<int>? Progress;
  void Report(int pct) => Progress?.Invoke(this, pct);
}

var d = new Downloader();
d.Progress += (s, pct) => Console.WriteLine($"{pct}%");

In .NET, events conventionally use EventHandler or EventHandler<T> with EventArgs.

Notes

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Microsoft Learn (.NET docs), Work with delegate types in C# - C#, CC BY 4.0 (dotnet/docs); Microsoft Learn (.NET docs), Events - C#, CC BY 4.0 (dotnet/docs).

Cite this

Permanent ID: iil:note:hmexbda2

iinventedlight. 2026. "C# delegates and events." iinventedlight Library, iil:note:hmexbda2, version of 2026-11-04. https://iinventedlight.com/library/notes/csharp-delegates-events/. License: CC-BY-4.0.

@misc{iil_note_hmexbda2,
  author = {{iinventedlight}},
  title = {{C\# delegates and events}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-04},
  url = {https://iinventedlight.com/library/notes/csharp-delegates-events/},
  note = {Permanent ID iil:note:hmexbda2. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/csharp-delegates-events.md.