C# | Check if HybridDictionary is Synchronized (thread safe) Last Updated : 01 Feb, 2019 Comments Improve Suggest changes Like Article Like Report 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.IsSynchronized property: Example 1: CSHARP // C# code to check whether the // HybridDictionary is synchronized // (thread safe). using System; using System.Collections; using System.Collections.Specialized; class GFG { // Driver code public static void Main() { // Creating a HybridDictionary named myDict HybridDictionary myDict = new HybridDictionary(); // Adding key/value pairs in myDict myDict.Add("I", "first"); myDict.Add("II", "second"); myDict.Add("III", "third"); myDict.Add("IV", "fourth"); myDict.Add("V", "fifth"); // To check whether the HybridDictionary // is synchronized (thread safe). Console.WriteLine(myDict.IsSynchronized); } } Output: False Example 2: CSHARP // C# code to check whether the // HybridDictionary is synchronized // (thread safe). using System; using System.Collections; using System.Collections.Specialized; class GFG { // Driver code public static void Main() { // Creating a HybridDictionary named myDict HybridDictionary myDict = new HybridDictionary(); // Adding key/value pairs in myDict myDict.Add("key1", "value1"); myDict.Add("key2", "value2"); myDict.Add("key3", "value3"); myDict.Add("key4", "value4"); myDict.Add("key5", "value5"); // To check whether the HybridDictionary // is synchronized (thread safe). Console.WriteLine(myDict.IsSynchronized); } } Output: False Note: Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads. Reference: https://docs.microsoft.com/en-us/dotnet/api/system.collections.specialized.hybriddictionary.issynchronized?view=netframework-4.7.2 Comment More infoAdvertise with us Next Article C# | Check if HybridDictionary is Synchronized (thread safe) S Sahil_Bansall Follow Improve Article Tags : C# CSharp-Specialized-Namespace CSharp-Specialized-HybridDictionary Similar Reads C# | Check if Hashtable is synchronized (thread safe) 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 2 min read C# | Check if ListDictionary is synchronized (thread safe) ListDictionary.IsSynchronized property is used to get a value indicating whether the ListDictionary is synchronized (thread safe) or not. Syntax: public bool IsSynchronized { get; } Return Value: This property always returns false. Below are the programs to illustrate the use of ListDictionary.IsSyn 1 min read C# | Check if HybridDictionary is read only HybridDictionary.IsReadOnly property is used to get a value that indicates whether the HybridDictionary is read-only or not. Syntax: public bool IsReadOnly { get; } Return Value: This property always returns false. Below programs illustrate the use of HybridDictionary.IsReadOnly property: Example 1: 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 StringDictionary is synchronized (thread safe) StringDictionary.IsSynchronized property is used to get a value indicating whether access to the StringDictionary is synchronized (thread-safe). Syntax: public virtual bool IsSynchronized { get; } Return Value: This method returns True if access to the StringDictionary is synchronized (thread safe), 1 min read Like