TypeName | SA1312VariableNamesMustBeginWithLowerCaseLetter |
CheckId | SA1312 |
Category | Naming Rules |
📝 This rule is new for StyleCop Analyzers, and was not present in StyleCop Classic.
The name of a variable in C# does not begin with a lower-case letter.
A violation of this rule occurs when the name of a variable does not begin with a lower-case letter.
If the variable name is intended to match the name of an item associated with Win32 or COM, and thus needs to begin with
an upper-case letter, place the variable within a special NativeMethods
class. A NativeMethods
class is any class
which contains a name ending in NativeMethods
, and is intended as a placeholder for Win32 or COM wrappers. StyleCop
will ignore this violation if the item is placed within a NativeMethods
class.
To fix a violation of this rule, change the name of the variable so that it begins with a lower-case letter, or place
the item within a NativeMethods
class if appropriate.
#pragma warning disable SA1312 // VariableNamesMustBeginWithLowerCaseLetter
int Variable = 3;
#pragma warning restore SA1312 // VariableNamesMustBeginWithLowerCaseLetter