Qus:    How to make thread safe with collections
Nov 21, 2020 19:03 DotNet 2 Answers Views: 1597 FRAUSKY

Collections classes can be made thread safe using any of the following methods:



Create a thread-safe wrapper using the Synchronized method, and access the collection exclusively through that wrapper.



If the class does not have a Synchronized method, derive from the class and implement a Synchronized method using the SyncRoot property.

Prev Next
Answers (2)
DIVYA Nov 23, 2020 14:11
Answer:   By using the SynchronizedCollection has a built-in synchronization object which can be used to make collection thread-safe, and this can be used for specific requirement.

PARTH Nov 23, 2020 15:57
Answer:   Collections classes can be made thread safe using any of the following methods:

Create a thread-safe wrapper using the Synchronized method, and access the collection exclusively through that wrapper.

If the class does not have a Synchronized method, derive from the class and implement a Synchronized method using the SyncRoot property.

Post Your Answer
Guest User

Not sure what solution is right for you?

Choose the right one for you.
Get the help of the experts and find a solution that best suits your needs.


Let`s Connect