C# | Check if StringCollection is synchronized (thread safe)
Last Updated :
01 Feb, 2019
StringCollection class is a new addition to the .NET Framework class library that represents a collection of strings. StringCollection class is defined in the System.Collections.Specialized namespace.
StringCollection.IsSynchronized property is used to get a value indicating whether access to the StringCollection is synchronized (thread safe) or not.
Syntax:
public bool IsSynchronized { get; }
Return Value: This property always returns false.
Note: Retrieving the value of this property is an O(1) operation.
Example:
using System;
using System.Collections;
using System.Collections.Specialized;
class GFG {
public static void Main()
{
StringCollection myCol = new StringCollection();
String[] myArr = new String[] { "A" , "B" , "C" , "D" , "E" };
myCol.AddRange(myArr);
Console.WriteLine(myCol.IsSynchronized);
}
}
|
Reference:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...