BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.Attribute System.AttributeUsage(System.AttributeTargets.Enum, Inherited=false) System.Runtime.InteropServices.ComVisible(true)

Indicates that the targeted by the current attribute is declared as a bit-field.

The class provides the consumer of a the information that the enumeration is to be used as a bit-field. Additionally, when formatting a , using the causes a value that is a bitwise OR combination of multiple fields to print correctly.

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 applied to enumerations.

The following example demonstrates the use of on the formatting of a . With this attribute, the enumeration is used as a bit-field, and the value 3 (Top | Left) is considered a valid value for the enumeration when formatting. Without this attribute, the enumeration is not used as a bit-field, and the value 3 (Red | Blue) is not considered a valid value for the enumeration when formatting.

`using System; [FlagsAttribute()] public enum Position { Top = 0x1, Left = 0x2, Bottom = 0x4, Right = 0x8 } //enum Color declared without FlagsAttribute public enum Color { Red = 0x1, Blue = 0x2, Yellow = 0x4 } public class enumFormat { public static void Main() { Position p = Position.Top | Position.Left; Console.WriteLine("Position: {0}", p); Color c = Color.Red | Color.Blue; Console.WriteLine("Color: {0}", c); } }`

The output is

Position: Top, Left

Color: 3

- Constructor

  Constructs a new instance of the class.

  To be added.
  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
0