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.