Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lock(collection){
- foreach (object o in collection){
- ...
- }
- }
- ICollection MyCollection;
- // Instantiate and populate the collection
- lock(MyCollection.SyncRoot) {
- // Some operation on the collection, which is now thread safe.
- }
Add Comment
Please, Sign In to add comment