---
source: https://iinventedlight.com/library/notes/csharp-records.md
title: "C# records: value equality, with-expressions, positional syntax"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC BY 4.0 (dotnet/docs); restated in our own words"
attribution: "Summary by iinventedlight (AI-assisted). Sources: Microsoft Learn, Records (C# reference), CC BY 4.0 (dotnet/docs); Microsoft Learn, Create record types in 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-05
as_of: 2026-11-05
confidence: medium
untested: "Steps and code were not run; only the fetched documentation page was read."
category: coding-references
topic_area: "code-systems: C# record types"
tags: csharp, dotnet, records, immutability
sources:
  - id: S1
    title: "Records (C# reference)"
    publisher: Microsoft Learn
    url: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/record
    accessed: 2026-11-05
    license: "CC BY 4.0 (dotnet/docs)"
  - id: S2
    title: "Create record types in C#"
    publisher: Microsoft Learn
    url: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/tutorials/records
    accessed: 2026-11-05
    license: "CC BY 4.0 (dotnet/docs)"
    license: "CC BY 4.0 (dotnet/docs)"
---
# C# records: value equality, with-expressions, positional syntax

## Short answer
A `record` is a reference type built for data. Two records of the same type with the same values compare equal. Use `with` for a copy that changes selected properties. [S1]

## Sketch
```csharp
public record Person(string First, string Last);
var p2 = p1 with { Last = "Smith" };
```

## Points
- Records compare by value, not by reference identity. [S1]
- `with` gives nondestructive updates. [S1]
- Positional records and record structs are everyday features of the type. [S2]
- Entity Framework Core still expects reference equality for tracked entities. [S1]

## Claims
- id: C1
  claim: Records of the same type with the same values are equal.
  source: S1
  evidence: "equal if they are of the same type and store the same values"
- id: C2
  claim: with expressions support nondestructive mutation.
  source: S1
  evidence: "use a with expression to achieve nondestructive mutation"
- id: C3
  claim: EF Core depends on reference equality.
  source: S1
  evidence: "Entity Framework Core depends on reference equality"
- id: C4
  claim: Everyday record features include value equality and with expressions.
  source: S2
  evidence: "value equality, positional syntax, and with expressions"

## Sources
- [S1] Records (C# reference). Microsoft Learn. https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/record . License: CC BY 4.0 (dotnet/docs). Accessed 2026-11-05.
- [S2] Create record types in C#. Microsoft Learn. https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/tutorials/records . License: CC BY 4.0 (dotnet/docs). Accessed 2026-11-05.

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

Source notice: .NET documentation © Microsoft. Licensed under Creative Commons Attribution 4.0 International (https://github.com/dotnet/docs/blob/main/LICENSE).
