---
source: https://iinventedlight.com/library/notes/csharp-lambda-expressions.md
title: "C# lambda expressions and delegates"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC BY 4.0 (dotnet/docs); prose restates cited source lines"
attribution: "Summary by iinventedlight (AI-assisted). Sources: Microsoft Learn (.NET docs), Lambda expressions - Lambda expressions and anonymous functions - C# reference, CC BY 4.0 (dotnet/docs); Microsoft Learn (.NET docs), Work with delegate types in C# - C#, CC BY 4.0 (dotnet/docs)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-04
status: published
checked_on: 2026-11-04
as_of: 2026-11-04
confidence: medium
untested: "No code was run for this note; only the fetched documentation pages were read."
category: coding-references
topic_area: "code-ai-eng: C# and .NET"
tags: csharp, dotnet, lambdas, delegates
sources:
  - id: S1
    title: "Lambda expressions - Lambda expressions and anonymous functions - C# reference"
    publisher: Microsoft Learn (.NET docs)
    url: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/lambda-expressions
    accessed: 2026-11-04
    license: "CC BY 4.0 (dotnet/docs)"
  - id: S2
    title: "Work with delegate types in C# - C#"
    publisher: Microsoft Learn (.NET docs)
    url: https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/delegates/
    accessed: 2026-11-04
    license: "CC BY 4.0 (dotnet/docs)"
---
# C# lambda expressions and delegates

## Short answer
To create a lambda expression, specify input parameters (if any) on the left side of the lambda operator and an expression or a statement block on the other side. (S1) Lambdas are usually assigned to delegate types such as `Func<>` and `Action<>`, which are type-safe references to methods. [S1][S2]

```csharp
Func<int, int> square = x => x * x;
Action<string> log = msg => { Console.WriteLine(msg); };
```

## Key points
- Delegates let you pass methods as arguments, and event handlers are invoked through them. [S2]
- Assigned to `Expression<Func<...>>`, a lambda becomes an expression tree instead of code (used by LINQ providers). [S1]

## Claims
- id: C1
  claim: The => operator separates a lambda's parameters from its body.
  source: S1
  evidence: "Use the lambda declaration operator => to separate the lambda's parameter list from its body."
- id: C2
  claim: A lambda can be assigned to a Func delegate.
  source: S1
  evidence: "Func<int, int> square = x => x * x;"
- id: C3
  claim: A delegate represents references to methods with a given signature.
  source: S2
  evidence: "A delegate is a type that represents references to methods"
- id: C4
  claim: Delegates pass methods as arguments to other methods.
  source: S2
  evidence: "Delegates are used to pass methods as arguments to other methods."

## Sources
- [S1] Lambda expressions - Lambda expressions and anonymous functions - C# reference. Microsoft Learn (.NET docs). https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/lambda-expressions . License: CC BY 4.0 (dotnet/docs). Accessed 2026-11-04.
- [S2] Work with delegate types in C# - C#. Microsoft Learn (.NET docs). https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/delegates/ . License: CC BY 4.0 (dotnet/docs). Accessed 2026-11-04.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
