![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
CopyOnWriteArrayList version in C#
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 |
---|---|
1 | Count Counts the number of elements in the thread-safe collection. |
2 | Item[Int32] Gets an element from the thread-safe collection with a specified index. |
3 | Items Gets the list of elements contained in the thread-safe collection. |
4 | SyncRoot Gets the object used to synchronize access to the thread-safe collection. |
Advertisements