Total .NET Analyzer Rule Documentation |
|
ReduceMemberVisibility Rule
Reduce the visibility of the members to provide the least amount of access possible.
Remarks
Subroutine and Function visibility should be restricted to provide the least amount of access possible. Restricting member visibility reduces naming conflicts and prevents members from being used incorrectly. The visibility of a member is determined by the keyword(s) used in the declaration statement.
Resolution
Review the member 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 member will be accessible anywhere within the project and from other projects referencing the project.
Protected: The member will be accessible only within the class or derived classes.
Friend: The member will be accessible anywhere in the same project, but not from other projects.
Private: The member will be accessible only within the same module, class, or structure.
See Also
Choosing Access Levels for Methods