Qus:    How to make thread safe with collections
Nov 21, 2020 13:03 2 Answers Views: 703 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 08: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 09: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 course is right for you?

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


Let`s Connect