Editorconfig Guide.e

Prefer readonly struct

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

Prefer readonly struct

csharp-style-prefer-readonly-struct

This option controls whether structs whose instance state is never mutated should be marked readonly.

Default value:

true

Possible values:

  • true
  • false

Examples

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