Although this is not the same (you can do it this way), how about Dictionary<string,object> .
Does this work?
dict.Add("somekey",new object()); lock (dict["somekey"]) { ... }
This will allow the thread to block the named instance of the object, which I think will do what you want.
Lloyd source share