Get an object to synchronize access to a SortedList in CSharp
Description
The following code shows how to get an object to synchronize access to a SortedList.
Example
/*from ww w . j av a2s .co m*/
using System.Collections;
using System;
public class MainClass{
public static void Main(String[] argv){
SortedList myCollection = new SortedList();
lock(myCollection.SyncRoot)
{
foreach (object item in myCollection)
{
// Insert your code here.
Console.WriteLine("code");
}
}
}
}