It does nothing particularly useful, no.
In particular, if you have:
x = foo.Indicators["blah"]
then the index will execute without a thread holding the lock ... so it is not thread safe. Think about the code above, for example:
Dictionary<string, Indicator> indicators = foo.Indicators;
Do you ever need to do anything with a collection other than accessing it through an index? If not, you can simply replace the property with a method:
public Indicator GetIndicator(string name) { lock (indicators) { return indicators[name]; } }
(Instead, you can use TryGetValue , etc. - it depends on what you are trying to achieve.)
Personally, I would prefer to use a link to a private and unused lock object, rather than link assembly, but this is a separate matter.
As mentioned elsewhere, ConcurrentDictionary is your friend if you are using .NET 4, but of course it is not available before that :(
source share