C# BitArray IsSynchronized

Description

BitArray IsSynchronized gets a value indicating whether access to the BitArray is synchronized (thread safe).

Syntax

BitArray.IsSynchronized has the following syntax.


public bool IsSynchronized { get; }

Example

The following code example shows how to lock the collection using the SyncRoot during the entire enumeration.


//from   w  w  w.j a va  2s  .com

using System;
using System.Linq;
using System.Collections;
public class MainClass{
  public static void Main(String[] argv){  
    BitArray myCollection = new BitArray(64, true);
    lock(myCollection.SyncRoot)
    {
        foreach (object item in myCollection)
        {
            // Insert your code here.
        }
    }

  }
}
    




















Home »
  C# Tutorial »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack