C# StringDictionary SyncRoot
Description
StringDictionary SyncRoot
gets an object that can be
used to synchronize access to the StringDictionary.
Syntax
StringDictionary.SyncRoot
has the following syntax.
public virtual Object SyncRoot { get; }
Example
using System;/*w w w. j a va 2 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.
}
}
}
}