Total .NET Analyzer Rule Documentation  

ReduceFieldVisibility Rule

Reduce the visibility of the field to provide the least amount of access possible.

Remarks

A variable's visibility should be restricted to provide the least amount of access possible. Restricting variable visibility reduces naming conflicts and prevents variables from being used incorrectly. The visibility of a variable is determined by the keyword(s) used in the declaration statement.

Resolution

Review the variable to determine where it is used, and adjust the scope appropriately. Make the visibility as limited as possible. The following options are available:

Public: The variable will be accessible anywhere within the project and from other projects referencing the project.
Protected: The variable will be accessible only within the class or derived classes.
Friend: The variable will be accessible anywhere in the same project, but not from other projects.
Private: The variable will be accessible only within the same module, class, or structure.

See Also

Variable Declaration

Accessibility