feat: Adding IcdOrderedDictionary constructor for populating with an existing dictionary

This commit is contained in:
Chris Cameron
2018-10-16 14:32:27 -04:00
parent 85ab631ef5
commit 692da3253f

View File

@@ -80,6 +80,20 @@ namespace ICD.Common.Utils.Collections
m_Dictionary = new Dictionary<TKey, TValue>(equalityComparer);
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="dictionary"></param>
public IcdOrderedDictionary(IEnumerable<KeyValuePair<TKey, TValue>> dictionary)
: this()
{
if (dictionary == null)
throw new ArgumentNullException("dictionary");
foreach (KeyValuePair<TKey, TValue> kvp in dictionary)
Add(kvp.Key, kvp.Value);
}
#region Methods
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()