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/SA1401.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,8 @@ A violation of this rule occurs whenever a field in a class is given non-private
25
25
26
26
Fields located within C# structs are allowed to have any access level.
27
27
28
+
Fields that are static and readonly will not raise a violation. These kinds of fields are commonly used to represent a constant value when the `const` keyword cannot be used, and therefore they are exempt from this rule.
29
+
28
30
## How to fix violations
29
31
30
32
To fix a violation of this rule, make the field private and add a property to expose the field outside of the class.
0 commit comments