C# Hashtable IsSynchronized
Description
Hashtable IsSynchronized
gets a value indicating whether
access to the Hashtable is synchronized (thread safe).
Syntax
Hashtable.IsSynchronized
has the following syntax.
public virtual bool IsSynchronized { get; }
Example
The following example shows how to synchronize a Hashtable, determine if a Hashtable is synchronized, and use a synchronized Hashtable.
using System;/* ww w .j a va 2 s. co m*/
using System.Collections;
public class SamplesHashtable {
public static void Main() {
Hashtable myHT = new Hashtable();
myHT.Add( 0, "zero" );
myHT.Add( 1, "one" );
myHT.Add( 2, "two" );
myHT.Add( 3, "three" );
myHT.Add( 4, "four" );
Hashtable mySyncdHT = Hashtable.Synchronized( myHT );
Console.WriteLine(myHT.IsSynchronized);
Console.WriteLine(mySyncdHT.IsSynchronized);
}
}
The code above generates the following result.