C#


ROSLYN.DESIGN.CA1008 : Enums should have zero value (C#)

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

Summary

The default value of an uninitialized enumeration, just as other value types, is zero. A nonflags-attributed enumeration should define a member by using the value of zero so that the default value is a valid value of the enumeration. If an enumeration that has the FlagsAttribute attribute applied defines a zero-valued member, its name should be ""None"" to indicate that no values have been set in the enumeration.

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

Properties

Class Name Enums should have zero value (C#)
Significance reliability
Mnemonic ROSLYN.DESIGN.CA1008
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="Enums should have zero value (C#)"

Relevant Configuration File Parameters

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