Get an object that can be used to synchronize access to the ListDictionary in CSharp
Description
The following code shows how to get an object that can be used to synchronize access to the ListDictionary.
Example
using System;/*from w w w . j a v a 2 s .c o m*/
using System.Collections;
using System.Collections.Specialized;
public class SamplesListDictionary {
public static void Main() {
ListDictionary myCollection = new ListDictionary();
lock(myCollection.SyncRoot)
{
foreach (object item in myCollection)
{
// Insert your code here.
Console.WriteLine("code");
}
}
}
}