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

Description

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

Example


using System;/*  w  ww  . j  a v  a2  s. com*/
using System.Collections;
using System.Collections.Specialized;

public class SamplesStringDictionary  {

   public static void Main()  {
        StringDictionary myCollection = new StringDictionary();
        lock(myCollection.SyncRoot)
        {
            foreach (Object item in myCollection)
            {
                // Insert your code here.
                Console.WriteLine(item);
            }
        }
   }

}




















Home »
  C# Tutorial »
    Collections »




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