Read‑only Fields
Read‑only fields can be assigned only in the constructor or at declaration.
class Example {public readonly int Value;public Example(int v) { Value = v; }}var ex = new Example(42);Console.WriteLine(ex.Value);Run the Application
Section titled “Run the Application”dotnet runResult
Section titled “Result”42