C#


ROSLYN.DESIGN.CA1051 : Do not declare visible instance fields (C#)

See Roslyn-Detected C# Warning Classes for more information.

Summary

The primary use of a field should be as an implementation detail. Fields should be private or internal and should be exposed by using properties.

This check corresponds to Roslyn rule CA1051. For full rule details, see the Microsoft website: CA1051.

Properties

Class Name Do not declare visible instance fields (C#)
Significance reliability
Mnemonic ROSLYN.DESIGN.CA1051
Categories None
Availability Available for C# only.
Enabling Checks for this warning class are enabled by default. To disable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += discard class="Do not declare visible instance fields (C#)"

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.