VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/c-sharp-icollection-issynchronized-property-with-examples/

⇱ C# ICollection.IsSynchronized Property with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C# ICollection.IsSynchronized Property with Examples

Last Updated : 18 Feb, 2022

ICollection is an interface that contains size, enumerations, and synchronization methods for all nongeneric collections. It is the base interface for classes in System.Collections namespace. IsSynchronized is also a property of the ICollection interface. This property in C# is defined under System.Collections namespace and a part of System.Runtime.dll assembly. It is used to check whether the access to the ICollection is thread-safe i.e, synchronized or not. It will return true if the access to the IsCollection is thread-safe. Otherwise, it will return false. 

Syntax:

public bool IsSynchronized { get; }

Return type: The return type of this property is Boolean, i.e. either true or false. It will return true if the access to the IsCollection is thread-safe (or synchronized). Or it will return false when the access to the IsCollection is not thread-safe (or non-synchronized)

Example: In this example, we have initialized str with string literals. Then, we are passing it to the Display() function as a parameter. Display() method accepts it as an ICollection interface. Finally, we have used ICollection.IsSynchronized property on it.


Output
IsSynchronized: False
Comment
Article Tags:

Explore