Code inspection: Redundant 'readonly' modifier
This inspection reports a readonly modifier when the member is already readonly by definition or because of its containing declaration. In that case, the modifier is redundant and can be removed without changing behavior.
readonly struct S
{
public readonly int GetValue() => 42;
}
readonly struct S
{
public int GetValue() => 42;
}
This also applies to cases such as get-only auto-properties or auto-properties with get; init; in readonly structs.
13 April 2026