<p>Hashtables have a syncroot property but generic dictionaries don't.  If I have code that does this:</p>

<pre><code>lock (hashtable.Syncroot)
{
....
}
</code></pre>

<p>How do I replicate this if I am removing the hashtable and changing to generic dictionaries?</p>

```
```
var dictionary = new Dictionary<int, string>();

lock(((ICollection) dictionary).SyncRoot)
{
    // ...
}
```
```