Test Design StudioGo to Previous Topic: CA0121 - Use error handling with cautionGo to Next Topic: CA1051 - Do not declare visible instance fields

CA1044 - Properties should not be write only

Summary

In general, there is little case for having a property that is write-only. Consumers of classes expect properties to be either read-only or read-write, but not write-only. This can result in careless errors when a consumer attempts to read the value of the property.

Solution

The easiest solution is to provide a Property Get declaration for your property so that the property becomes read-write. If you are unable to return the property (as might be the case for secure information such as passwords), consider changing your write-only property into a Sub declaration that is used to set the necessary value. This will reduce confusion about the use of the property.