C# | Check if Hashtable is synchronized (thread safe) Last Updated : 01 Feb, 2019 Comments Improve Suggest changes Like Article Like Report Hashtable.IsSynchronized Property is used to get a value indicating whether access to the Hashtable is synchronized(thread-safe). Syntax: public virtual bool IsSynchronized { get; } Return Value: This property return true if access to the Hashtable is synchronized (thread-safe), otherwise it returns false. The default is false. Below programs illustrate the use of above-discussed property: Example 1: CSharp // C# code to check if Hashtable // Is Synchronized or not using System; using System.Collections; class GFG { // Driver code public static void Main() { // create and initialize Hashtable // using Add() method Hashtable has1 = new Hashtable(); has1.Add("1", "Welcome"); has1.Add("2", "to"); has1.Add("3", "geeks"); has1.Add("4", "for"); has1.Add("5", "geeks"); // Creates a synchronized // wrapper around the Hashtable. Hashtable smyTable = Hashtable.Synchronized(has1); // Displays the synchronization // status of both Hashtables. Console.WriteLine("has1 is {0}.", has1.IsSynchronized ? "Synchronized" : "Not Synchronized"); Console.WriteLine("smyTable is {0}.", smyTable.IsSynchronized ? "Synchronized" : "Not Synchronized"); } } Output: has1 is Not Synchronized. smyTable is Synchronized. Example 2: CSharp // C# code to check if Hashtable // Is Synchronized or not using System; using System.Collections; class GFG { // Driver code public static void Main() { // Creating a Hashtable Hashtable myTable = new Hashtable(); // Adding elements in Hashtable myTable.Add("G", "Geeks"); myTable.Add("C", "C#"); myTable.Add("D", "Data Structures"); myTable.Add("Q", "Quiz"); // Checking if Hashtable is // synchronized (thread safe) Console.WriteLine(myTable.IsSynchronized); } } Output: False Note: A Hashtable can support one writer and multiple readers concurrently. To support multiple writers, all operations must be done through the wrapper returned by the Synchronized method. Reference: https://docs.microsoft.com/en-us/dotnet/api/system.collections.hashtable.issynchronized?view=netframework-4.7.2 Comment More infoAdvertise with us Next Article C# | Check if Hashtable is synchronized (thread safe) K Kirti_Mangal Follow Improve Article Tags : C# CSharp-Collections-Hashtable CSharp-Collections-Namespace Similar Reads C# | Check if HybridDictionary is Synchronized (thread safe) HybridDictionary.IsSynchronized property is used to get a value that indicates whether the HybridDictionary is synchronized (thread safe) or not. Syntax: public bool IsSynchronized { get; } Return Value: This property always returns false. Below programs illustrate the use of HybridDictionary.IsSync 2 min read C# | Check if ArrayList is Synchronized (thread safe) ArrayList.IsSynchronized Property is used to get a value which indicate whether access to the ArrayList is synchronized (thread safe). Syntax: public virtual bool IsSynchronized { get; } Return Value: This property returns the true if access to the ArrayList is synchronized (thread safe) otherwise i 2 min read C# | Check if the BitArray is synchronized (thread safe) The BitArray class manages a compact array of bit values, which are represented as Booleans, where true indicates that the bit is on i.e, 1 and false indicates the bit is off i.e, 0. This class is contained in System.Collections namespace. BitArray.IsSynchronized property is used to get a value indi 2 min read C# | Check if Hashtable is read-only Hashtable.IsReadOnly property is used to get a value indicating whether the Hashtable is read-only or not. Syntax: public virtual bool IsReadOnly { get; } Return Value: This property returns true if the Hashtable is read-only otherwise it returns false. The default is false. Below programs illustrat 2 min read C# | Check if an array is synchronized (thread safe) or not Array.IsSynchronized Property is used to get a value which indicates whether access to the Array is synchronized (thread-safe) or not. Syntax: public bool IsSynchronized { get; } Property Value: This property always returns false for all arrays. Below programs illustrate the use of above-discussed p 2 min read Like