LANGUAGE

with expression

Creates a modified copy; default copying is shallow.

Formal Syntax & Structure

csharp syntaxcsharp
original with { Property = value }

Working Example

Example Snippetcsharp
var original = new Cell(1, 2);var copy = original with { Column = 3 };record struct Cell(int Row, int Column);
C# & .NET Reference