C# BitVector32 CreateMask()
Description
BitVector32 CreateMask()
creates the first mask in a
series of masks that can be used to retrieve individual bits in a BitVector32
that is set up as bit flags.
Syntax
BitVector32.CreateMask()
has the following syntax.
public static int CreateMask()
Returns
BitVector32.CreateMask()
method returns A mask that isolates the first bit flag in the BitVector32.
Example
using System;// ww w. j a v a 2s.com
using System.Collections.Specialized;
public class SamplesBitVector32 {
public static void Main() {
BitVector32 myBV = new BitVector32( 0 );
int myBit1 = BitVector32.CreateMask();
int myBit2 = BitVector32.CreateMask( myBit1 );
int myBit3 = BitVector32.CreateMask( myBit2 );
int myBit4 = BitVector32.CreateMask( myBit3 );
int myBit5 = BitVector32.CreateMask( myBit4 );
Console.WriteLine( "Initial: \t{0}", myBV.ToString() );
myBV[myBit3] = true;
Console.WriteLine( "myBit3 = TRUE \t{0}", myBV.ToString() );
myBV[myBit4 + myBit5] = true;
Console.WriteLine( "myBit4 + myBit5 = TRUE \t{0}", myBV.ToString() );
myBV[myBit1 | myBit2] = true;
Console.WriteLine( "myBit1 | myBit2 = TRUE \t{0}", myBV.ToString() );
}
}
The code above generates the following result.