Last active
October 31, 2020 16:46
-
-
Save joao-r-reis/ba81aea1812b7ff74e54627e864e8be5 to your computer and use it in GitHub Desktop.
InitializeFromCollection.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void InitializeFromCollection(IEnumerable<KeyValuePair<TKey, TValue>> collection) | |
{ | |
TValue dummy; | |
foreach (KeyValuePair<TKey, TValue> pair in collection) | |
{ | |
if (pair.Key == null) throw new ArgumentNullException("key"); | |
if (!TryAddInternal(pair.Key, pair.Value, false, false, out dummy)) | |
{ | |
throw new ArgumentException(GetResource("ConcurrentDictionary_SourceContainsDuplicateKeys")); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment