lock(dictionaryX) { dictionaryX.TryGetValue(key, out value); }
is locking necessary while doing lookups to a Dictionary ?
THe program is
Yes you need to lock the dictionary for access in a multithreaded environment. The writing to a dictionary is not atomic, so it could add the key, but not the value. In that case when you access it, you could get an exception.