In this description article it is explained that
records are immutable by default
But records can be used just like a normal class:
using System;
record A
{
public int u;
public int U
{
set { u = value; }
}
internal void f() => u++;
}
record Program
{
static void Main()
{
A x = new A() { u = 1000 };
x.U = 100;
x.f();
Console.WriteLine(x);
Console.ReadKey();
}
}
What is meant by the immutability of a record?