Get the number of elements contained in the BitArray CSharp

Description

The following code shows how to get the number of elements contained in the BitArray.

Example


//from w  w w .  ja  v  a2  s.c  o m
using System;
using System.Collections;
public class SamplesBitArray  {
   public static void Main()  {
      BitArray myBA = new BitArray( new byte[]{0,0,0,1} );
      myBA[0] = true;
      Console.WriteLine(myBA.Count);
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Collections »




ArrayList
BitArray
Collection
Comparer
HashSet
Hashtable
LinkedList
List
ListDictionary
OrderedDictionary
Queue
SortedList
SortedSet
Stack
StringCollection
StringDictionary