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);
}
}
}
}