IsReadOnly
Gets or sets a value indicating whether the type is declared with the readonly modifier.
Declaration
bool IsReadOnly { get; set; }Property Value
| Type | Description |
|---|---|
| bool |
Remarks
The language allows the readonly modifier on a struct only. The setter throws an
InvalidOperationException when the type being built is not a struct.
A readonly struct may declare no settable instance field and no automatic property that has a setter. Metalama does not refuse an advice that introduces one, and the compiler reports the error on the generated declaration.