public void Add(object key, object value) { if (key == null) { throw new ArgumentNullException(nameof(key)); } if (!KeyType.IsInstanceOfType(key)) { key = TypeDescriptor.GetConverter(KeyType).ConvertFrom(key); } if (key == null) { throw new ArgumentException("Key was converted to null.", nameof(key)); } if (Dictionary.Contains(key)) { Dictionary[key] = value; } else { Dictionary.Add(key, value); } }