record

A C# type declared with the record keyword for data, for which the compiler generates a constructor, properties, value equality, a readable ToString and with-expression copying.

In more detail

record Product(int Id, string Name); is one line. Records suit request and response types, whose data does not change in place. They are reference types unless declared record struct.

Example

public record Product(int Id, string Name);

Related terms

Taught in

References