Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1218,10 +1218,16 @@ void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[]
}

/// <inheritdoc/>
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item) =>
TryGetValue(item.Key, out TValue? value) &&
EqualityComparer<TValue>.Default.Equals(value, item.Value) &&
Remove(item.Key);
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
{
if (TryGetValue(item.Key, out TValue? value, out int index) && EqualityComparer<TValue>.Default.Equals(value, item.Value))
{
RemoveAt(index);
return true;
}

return false;
}

/// <inheritdoc/>
void IDictionary.Add(object key, object? value)
Expand All @@ -1237,11 +1243,6 @@ void IDictionary.Add(object key, object? value)
throw new ArgumentException(SR.Format(SR.Arg_WrongType, key, typeof(TKey)), nameof(key));
}

if (default(TValue) is not null)
{
ArgumentNullException.ThrowIfNull(value);
}

TValue tvalue = default!;
if (value is not null)
{
Comment thread
prozolic marked this conversation as resolved.
Expand Down
Loading