using System; using System.Collections.Generic; namespace fastJSON { internal class SafeDictionary<TKey, TValue> { private readonly object _Padlock = new object(); private readonly Dictionary<TKey, TValue> _Dictionary = new Dictionary<TKey, TValue>(); public bool ContainsKey(TKey key) { return _Dictionary.ContainsKey(key); } public TValue this[TKey key] { get { return _Dictionary[key]; } } public void Add(TKey key, TValue value) { lock(_Padlock) { _Dictionary.Add(key,value); } } } }
By viewing downloads associated with this article you agree to the Terms of use and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Skills that self-taught computer programmers lack