Hashtables have a syncroot property but generic dictionaries don\'t. If I have code that does this:
lock (hashtable.Syncroot)
{
....
}
How
If you are going strictly for compatability then Bryan is correct. This is the best way to maintain your current semantics on top of a Dictionary.
Expanding on it though. The reason the SyncRoot property was not directly added to the generic dictionary is that it's a dangerous way to do synchronization. It's only slighly better than "lock(this)" which is very dangerous and prone to deadlocks. Here are a couple of links that speak to why this is bad.