qualify-instance-members
What it does
Section titled “What it does”Reports a field, property, method or event of the containing type that is used by its simple name. The fix writes this. before it.
Why it matters
Section titled “Why it matters”With this. it is clear at a glance that the name is a member and not a local, a parameter or a static, so a reader does not scroll up to see where a name comes from. It is a style that some projects choose and others do not.
Example
Section titled “Example”...{ int x; static int s; int M() => x + s; int N() => this.x; void P(int x) { x = 1; M(); }}...{ int x; static int s; int M() => this.x + s; int N() => this.x; void P(int x) { x = 1; this.M(); }}Configuration
Section titled “Configuration”csharp: lint: rules: qualify-instance-members: warn # off (default), warn, errorEnabled by the presets: csharp/stylecop.
Suppress one line with sudsy-disable-next-line qualify-instance-members in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| StyleCop | SA1101 |
full |