NameValueCollection missing SyncRoot???

  • Thread starter Thread starter Wayne Brantley
  • Start date Start date
W

Wayne Brantley

In trying to make some parts of a NameValueCollection threadsafe, the docs
say use a property called SyncRoot, which is inherited form
NameObjectCollectionBase.

However, there is no such object...

NameValueCollection temp = new NameValueCollection();

temp.SyncRoot ???
 
Hi Wayne,

NameValueCollection and NameObjectCollectionBase classes do not provide
thread safe wrappers; you would need to create your own.
Secondly, SyncRoot property in the NameObjectCollectionBase is an explicit
implementation of ICollection.SyncRoot. So, cast your object to ICollection
to access the same
((ICollection)temp).SyncRoot
 
Back
Top