C#


ROSLYN.DESIGN.CA1044 : Properties should not be write only (C#)

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

Summary

Although it is acceptable and often necessary to have a read-only property, the design guidelines prohibit the use of write-only properties. This is because letting a user set a value, and then preventing the user from viewing that value, does not provide any security. Also, without read access, the state of shared objects cannot be viewed, which limits their usefulness.

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

Properties

Class Name Properties should not be write only (C#)
Significance reliability
Mnemonic ROSLYN.DESIGN.CA1044
Categories None
Availability Available for C# only.
Enabling Checks for this warning class are disabled by default. To enable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += allow class="Properties should not be write only (C#)"

Relevant Configuration File Parameters

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