C#idiomatic C#
withcsharp/language-reference/keywords

Language

`with` (C# reference)

with - C# Reference

  • page csharp/language-reference/keywords/with
  • updated 02/06/2026

Use the with keyword in the following contexts:

  • In a with expression to create a copy and apply modifications to one or more properties.
  • In a collection expression to specify parameters to the constructor for the initialized collection.

See also