.NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library
by Brad Abrams
Description
The System.FlagsAttribute class provides the consumer of a System.Enum with the information that the enumeration is to be used as a bit-field. Additionally, when formatting a System.Enum, using the System.FlagsAttribute causes a value that is a bitwise OR combination of multiple fields to print correctly.
[Note: Bit-fields are generally used for lists of elements that might occur in combination, whereas enumeration constants are generally used for lists of mutually exclusive elements. Therefore, bit-fields are designed to be combined with the bitwise OR operator to generate unnamed values, whereas enumerated constants are not. Languages vary in their usage of bit-fields compared to enumeration constants. This attribute can only be ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access