Get an object that can be used to synchronize access to the BitArray in CSharp

Description

The following code shows how to get an object that can be used to synchronize access to the BitArray.

Example


using System;//  ww  w  .  java2 s . com
using System.Collections;
public class SamplesBitArray  {
   public static void Main()  {
    BitArray myCollection = new BitArray(64, true);
    lock(myCollection.SyncRoot)
    {
        foreach (object item in myCollection)
        {
            // Insert your code here.
            Console.WriteLine("code");
        }
    }
   }
}

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