Editorconfig Guide.e

Prefer readonly struct member

EditorConfig key: csharp-style-prefer-readonly-struct-member

Prefer readonly struct member

csharp-style-prefer-readonly-struct-member

This option controls whether struct members that do not mutate instance state should be marked readonly.

Default value:

true

Possible values:

  • true
  • false

Examples

true
struct Point
{
  public readonly int x;
}
false
struct Point
{
  public int x;
}