C# BitVector32 CreateSection(Int16, BitVector32.Section)

Description

BitVector32 CreateSection(Int16, BitVector32.Section) creates a new BitVector32.Section following the specified BitVector32.Section in a series of sections that contain small integers.

Syntax

BitVector32.CreateSection(Int16, BitVector32.Section) has the following syntax.


public static BitVector32.Section CreateSection(
  short maxValue,
  BitVector32.Section previous
)

Parameters

BitVector32.CreateSection(Int16, BitVector32.Section) has the following parameters.

  • maxValue - A 16-bit signed integer that specifies the maximum value for the new BitVector32.Section.
  • previous - The previous BitVector32.Section in the BitVector32.

Returns

BitVector32.CreateSection(Int16, BitVector32.Section) method returns A BitVector32.Section that can hold a number from zero to maxValue.

Example


using System;//www . j  a va  2s .  c om
using System.Collections.Specialized;

public class SamplesBitVector32  {
   public static void Main()  {
      BitVector32 myBV = new BitVector32( 0 );

      BitVector32.Section mySect1 = BitVector32.CreateSection( 6 );
      BitVector32.Section mySect2 = BitVector32.CreateSection( 3, mySect1 );
      BitVector32.Section mySect3 = BitVector32.CreateSection( 1, mySect2 );
      BitVector32.Section mySect4 = BitVector32.CreateSection( 15, mySect3 );

      Console.WriteLine( "Changing the values of each section:" );
      Console.WriteLine( "\tInitial:    \t{0}", myBV.ToString() );
      myBV[mySect1] = 5;
      Console.WriteLine( "\tmySect1 = 5:\t{0}", myBV.ToString() );
      myBV[mySect2] = 3;
      Console.WriteLine( "\tmySect2 = 3:\t{0}", myBV.ToString() );
      myBV[mySect3] = 1;
      Console.WriteLine( "\tmySect3 = 1:\t{0}", myBV.ToString() );
      myBV[mySect4] = 9;
      Console.WriteLine( "\tmySect4 = 9:\t{0}", myBV.ToString() );

      Console.WriteLine( "New values:" );
      Console.WriteLine( "\tmySect1: {0}", myBV[mySect1] );
      Console.WriteLine( "\tmySect2: {0}", myBV[mySect2] );
      Console.WriteLine( "\tmySect3: {0}", myBV[mySect3] );
      Console.WriteLine( "\tmySect4: {0}", myBV[mySect4] );

   }

}

The code above generates the following result.





















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




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator