Exemplo n.º 1
0
        public void Add(TKey key, TValue value)
        {
            var keyBytes   = KeyToByteArray(key);
            var valueBytes = ValueToByteArray(value);

            _keyValueTrProtector.Start();
            _modificationCounter++;
            _keyValueTr.SetKeyPrefix(_prefix);
            if (_keyValueTr.FindExactKey(keyBytes))
            {
                throw new ArgumentException("Cannot Add duplicate key to Dictionary");
            }
            _keyValueTr.CreateOrUpdateKeyValueUnsafe(keyBytes, valueBytes);
            NotifyAdded();
        }