Why this matters
Poorly organized class members make code harder to navigate and maintain. Grouping members by accessibility improves readability.
Check if class members are grouped by accessibility (`public`, `protected`, `private`) to improve code readability and maintainability.
Poorly organized class members make code harder to navigate and maintain. Grouping members by accessibility improves readability.
Side-by-side examples engineers can pattern-match during review.
private int _value;
public void DoSomething() {}
public int Value { get; set; }public int Value { get; set; }
public void DoSomething() {}
private int _value;private int _value;
public void DoSomething() {}
public int Value { get; set; }public int Value { get; set; }
public void DoSomething() {}
private int _value;From the same buckets as this rule.
Check if loops use equality operators (== or !=) in termination conditions. These can lead to infinite loops if the condition is never met exactly. Instead, use relational operators like < or > for safer loop termination.