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.IsSynchronized property:
Example 1:
// C# code to check if ListDictionary // is synchronized (thread safe) using System; using System.Collections; using System.Collections.Specialized; class GFG { // Driver code public static void Main() { // Creating a ListDictionary named myDict ListDictionary myDict = new ListDictionary(); myDict.Add("Australia", "Canberra"); myDict.Add("Belgium", "Brussels"); myDict.Add("Netherlands", "Amsterdam"); myDict.Add("China", "Beijing"); myDict.Add("Russia", "Moscow"); myDict.Add("India", "New Delhi"); // Check if ListDictionary is // synchronized (thread safe) Console.WriteLine(myDict.IsSynchronized); } } |
chevron_right
filter_none
Output:
False
Example 2:
// C# code to check if ListDictionary // is synchronized (thread safe) using System; using System.Collections; using System.Collections.Specialized; class GFG { // Driver code public static void Main() { // Creating a ListDictionary named myDict ListDictionary myDict = new ListDictionary(); myDict.Add("1", "C"); myDict.Add("2", "C++"); myDict.Add("3", "Java"); myDict.Add("4", "Python"); myDict.Add("5", "C#"); myDict.Add("6", "Data Structure"); // Check if ListDictionary is // synchronized (thread safe) Console.WriteLine(myDict.IsSynchronized); } } |
chevron_right
filter_none
Output:
False
Reference:
Recommended Posts:
- C# | Check if StringCollection is synchronized (thread safe)
- C# | Check if Hashtable is synchronized (thread safe)
- C# | Check if an array is synchronized (thread safe) or not
- C# | Check if HybridDictionary is Synchronized (thread safe)
- C# | Check if ArrayList is Synchronized (thread safe)
- C# | Check if the BitArray is synchronized (thread safe)
- C# | Check if StringDictionary is synchronized (thread safe)
- C# | Creating a synchronized (thread-safe) wrapper for the Hashtable
- C# | Creating a synchronized (thread-safe) wrapper for the ArrayList
- C# | Creating a synchronized (thread-safe) wrapper for a SortedList object
- C# | Check if a thread belongs to managed thread pool or not
- How to check whether a thread is a background thread or not in C#
- C# | Check if ListDictionary is read-only
- C# | Check if ListDictionary contains a specific key
- C# | Check if ListDictionary has a fixed size
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



