Navigation:  StyleCop 4.3 > StyleCop 4.3 Rules > Naming Rules >

SA1306: FieldNamesMustBeginWithLowerCaseLetter

Previous pageReturn to chapter overviewNext page
StyleCop 4.3

Send comments on this topic.

SA1306: FieldNamesMustBeginWithLowerCaseLetter

Glossary Item Box

TypeName
FieldNamesMustBeginWithLowerCaseLetter

CheckId

SA1306

Category

Naming Rules

 

Cause

The name of a field or variable in C# does not begin with a lower-case letter

Rule Description

A violation of this rule occurs when the name of a field or variable begins with an upper-case letter. Field and variable names must begin with a lower-case letter, unless the field is public or internal, const, or non-private and readonly. In these cases, the field should begin with an upper-case letter.

If the field or 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 field or 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.

How to Fix Violations

To fix a violation of this rule, change the name of the field or variable so that it begins with a lower-case letter, or place the item within a NativeMethods class if appropriate.

 


© Microsoft Corporation. All Rights Reserved.