Java has CopyOnWriteArrayList, but C# does not have it. For that, the SynchronizedCollection Class in C#, should be preferred.
The SyncronizedCollection has a thread-safe collection containing objects of a type. Here is the syntax.
public class SynchronizedCollection<T> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IList, ICollection
Above, T is the type of object.
The following are the properties of the SyncronizedCollection class in C# −
|Sr.No.||Property Name & Description|
Counts the number of elements in the thread-safe collection.
Gets an element from the thread-safe collection with a specified index.
Gets the list of elements contained in the thread-safe collection.
Gets the object used to synchronize access to the thread-safe collection.