Update: It is acceptable if this method is not thread safe, but I\'m interested in learning how I would make it thread safe. Also, I do not want to lock on
Never lock on strings. In particular on those that are interned. See this blog entry on the danger of locking on interned strings.
Just create a new object and lock on that:
object myLock = new object();