Interview Question
Qus: How to make thread safe with collections
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.
Answers (2)
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.