About ThreadSafeStore<,>::AddValue.

Oct 15, 2013 at 8:29 PM
Hello!

I have a question about ThreadSafeStore<,>::AddValue implementation (https://github.com/JamesNK/Newtonsoft.Json/blob/master/Src/Newtonsoft.Json/Utilities/ThreadSafeStore.cs)

First, why you check (_store == null) when it's always is not null (value assigned in a ctor)?
if (_store == null)
{
    _store = new Dictionary<TKey, TValue>();
And, why do you need a copying values from a store?
Dictionary<TKey, TValue> newStore = new Dictionary<TKey, TValue>(_store);
As I can see, its means that you copy all store every time when a new value needed. Is it correct? Why you can not add a new value to an existing store?