.NET Framework Class Library  

FlagsAttribute Class

Indicates that an enumeration can be treated as a bit field; that is, a set of flags.

For a list of all members of this type, see FlagsAttribute Members.

System.Object
   System.Attribute
      System.FlagsAttribute

[Visual Basic]
<AttributeUsage(AttributeTargets.Enum)>
<Serializable>
Public Class FlagsAttribute
   Inherits Attribute
[C#]
[AttributeUsage(AttributeTargets.Enum)]
[Serializable]
public class FlagsAttribute : Attribute
[C++]
[AttributeUsage(AttributeTargets::Enum)]
[Serializable]
public __gc class FlagsAttribute : public Attribute
[JScript]
public
   AttributeUsage(AttributeTargets.Enum)
   Serializable
class FlagsAttribute extends Attribute

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Remarks

Bit fields can be combined using a bitwise OR operation, whereas enumerated constants cannot.

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 a bitwise OR operation to generate unnamed values, whereas enumerated constants are not. Languages vary in their use of bit fields compared to enumeration constants.

AttributeUsageAttribute is applied to this class, and its Inherited property specifies false. This attribute can only be applied to enumerations.

Requirements

Namespace: System

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework - Windows CE .NET

Assembly: Mscorlib (in Mscorlib.dll)

See Also

FlagsAttribute Members | System Namespace