public virtual void Add([NotNull] TKey key, [NotNull] TValue value) { if (key is null) { throw new ArgumentNullException(nameof(key)); } if (value is null) { throw new ArgumentNullException(nameof(value)); } if (ContainsKey(key)) { throw new ArgumentException(@"Already exists", nameof(key)); } if (ContainsValue(value)) { throw new ArgumentException(@"Already exists", nameof(value)); } Base.Add(key, value); Reversed.Add(value, key); }
public ImmutableMap <TKey, TValue> Add(TKey key, TValue value) { return(new ImmutableMap <TKey, TValue>(Base.Add(key, value), Reversed.Add(value, key))); }