Exemplo n.º 1
0
            public void AddOrUpdateByKey(KeyValuePair <TKey, TValue> item)
            {
                ValueWithIndex <TValue> v = null;

                if (this.DictionaryItems.TryGetValue(item.Key, out v))
                {
                    this._coreDictionary[item.Key] = item.Value;
                    base.SetItem(v.Index, item);
                }
                else
                {
                    this._coreDictionary[item.Key] = item.Value;
                    base.Add(item);
                }
                IncVer();
            }
Exemplo n.º 2
0
            public void RemoveByKey(TKey key)
            {
                //this._coreDictionary.Remove(key);
                ValueWithIndex <TValue> v = null;

                if (this.DictionaryItems.TryGetValue(key, out v))
                {
                    _coreDictionary.Remove(key);
                    base.RemoveAt(v.Index);
                }
                else
                {
                    _coreDictionary.Remove(key);
                }
                IncVer();
            }
 private void WriteOption(ValueWithIndex <SelectionValue> selection)
 => _consoleWriter.WriteLine($"{ToHumanIndex(selection.Index)}.) {selection.Value.Description}");