Ejemplo n.º 1
0
        private BaseImmutableDictionary <TKey, TValue> CopyAndMutate(Action <Dictionary <TKey, TValue> > mutator)
        {
            BaseImmutableDictionary <TKey, TValue> immutableDictionary = new BaseImmutableDictionary <TKey, TValue>();

            foreach (KeyValuePair <TKey, TValue> keyValuePair in this._dictionary)
            {
                immutableDictionary._dictionary.Add(keyValuePair.Key, keyValuePair.Value);
            }
            mutator(immutableDictionary._dictionary);
            return(immutableDictionary);
        }
        private BaseImmutableDictionary <TKey, TValue> CopyAndMutate(Action <Dictionary <TKey, TValue> > mutator)
        {
            BaseImmutableDictionary <TKey, TValue> dictionary = new BaseImmutableDictionary <TKey, TValue>();

            foreach (KeyValuePair <TKey, TValue> pair in _dictionary)
            {
                dictionary._dictionary.Add(pair.Key, pair.Value);
            }
            mutator(dictionary._dictionary);

            return(dictionary);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a dictionary with the specified initial capacity.
 /// </summary>
 /// <param name="capacity">the starting capacity of the dictionary</param>
 public ImmutableDictionary(int capacity)
 {
     _headDictionary = new BaseImmutableDictionary <TKey, TValue>(capacity);
 }
Ejemplo n.º 4
0
 /// <summary>Default constructor.</summary>
 public ImmutableDictionary()
 {
     _headDictionary = new BaseImmutableDictionary <TKey, TValue>();
 }