C# BitVector32 CreateMask(Int32)

Description

BitVector32 CreateMask(Int32) creates an additional mask following the specified 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(Int32) has the following syntax.


public static int CreateMask(
  int previous
)

Parameters

BitVector32.CreateMask(Int32) has the following parameters.

  • previous - The mask that indicates the previous bit flag.

Returns

BitVector32.CreateMask(Int32) method returns A mask that isolates the bit flag following the one that previous points to in BitVector32.

Example


using System;//ww w .  j a v a 2s .  c o  m
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.





















Home »
  C# Tutorial »
    System.Collections.Specialized »




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator