Home > Backend Development > C#.Net Tutorial > CopyOnWriteArrayList version in C#

CopyOnWriteArrayList version in C#

王林
Release: 2023-09-08 13:25:02
forward
1397 people have browsed it

C# 中的 CopyOnWriteArrayList 版本

Java has CopyOnWriteArrayList, but C# does not. For this purpose, the SynchronizedCollection class in C# should be used in preference.

SynchronizedCollection is a thread-safe collection containing objects of a specific type. The following is the syntax.

public class SynchronizedCollection<T> : IList<T>, ICollection<T>,
IEnumerable<T>, IEnumerable, IList, ICollection
Copy after login

Above, T is the type of object.

The following are the properties of the SyncronizedCollection class in C#-

Advanced number Property name and description
1 Count

Counts the number of elements in a thread-safe collection.

2 Item[Int32]

Gets an element specified from a thread-safe collection index.

3 Items

Get the number of elements contained in the list thread-safe collection.

4 SyncRoot

Gets the object used for synchronous access to thread-safe collections.

The above is the detailed content of CopyOnWriteArrayList version in C#. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template