Why this matters
Mutable fields can lead to unintended modifications. Use readonly for instance fields and const for compile-time constants.
readonly or const for Immutable DataEnsure that immutable instance fields are marked as readonly, and compile-time constants are marked as const.
Mutable fields can lead to unintended modifications. Use readonly for instance fields and const for compile-time constants.
Side-by-side examples engineers can pattern-match during review.
public int MaxValue = 100;
public const int MaxValue = 100;
From the same buckets as this rule.