You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/SA1101.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,14 @@ By default, StyleCop disallows the use of underscores or *m_* to mark local clas
27
27
28
28
A final advantage of using the 'this.' prefix is that typing *this.* will cause Visual Studio to show the IntelliSense popup, making it quick and easy for the developer to choose the class member to call.
29
29
30
+
When using property patterns, including the extended property pattern syntax introduced in C# 10, the rule does not require (or allow) `this.` to qualify the properties referenced by the pattern. These expressions refer to members of the value being matched rather than the containing type. For example, no SA1101 diagnostic is reported for the following:
31
+
32
+
```csharp
33
+
if (itemis { Outer.Inner: value })
34
+
{
35
+
}
36
+
```
37
+
30
38
## How to fix violations
31
39
32
40
To fix a violation of this rule, insert the 'this.' prefix before the call to the class member.
0 commit comments