Navigation:  StyleCop 4.3 > StyleCop 4.3 Rules > Maintainability Rules >

SA1400: AccessModifierMustBeDeclared

Previous pageReturn to chapter overviewNext page
StyleCop 4.3

Send comments on this topic.

SA1400: AccessModifierMustBeDeclared

Glossary Item Box

TypeName
AccessModifierMustBeDeclared

CheckId

SA1400

Category

Maintainability Rules

 

Cause

The access modifier for a C# element has not been explicitly defined.

Rule Description

C# allows elements to be defined without an access modifier. Depending upon the type of element, C# will automatically assign an access level to the element in this case.

This rule requires an access modifier to be explicitly defined for every element. This removes the need for the reader to make assumptions about the code, improving the readability of the code.

How to Fix Violations

To fix a violation of this rule, add an access modifier to the declaration of the element.

 


© Microsoft Corporation. All Rights Reserved.