Bit Flag Enums : Enum base type : Data Type C# Examples


C# Examples » Data Type » Enum base type »

 

Bit Flag Enums









    
using  System;
[Flags]
enum  BitValues:  uint
{
        NoBits  =  0,
        Bit1  =  0x00000001,
        Bit2  =  0x00000002,
        Bit3  =  0x00000004,
        Bit4  =  0x00000008,
        Bit5  =  0x00000010,
        AllBits  =  0xFFFFFFFF
}

class  MainClass
{
        public  static  void  Member(BitValues  value)
        {
                Console.WriteLine(value);
        }
        public  static  void  Main()
        {
                Member(BitValues.Bit1  |  BitValues.Bit2);
        }
}
    
   
  
   



Output

Bit1, Bit2


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Enum base type