feat: Extension method for populating a dict with a sequence of kvps

This commit is contained in:
Chris Cameron
2018-06-11 11:48:36 -04:00
parent f674d4c60d
commit 37a21131d9

View File

@@ -239,6 +239,26 @@ namespace ICD.Common.Utils.Extensions
return change;
}
/// <summary>
/// Adds the sequence of items to the dictionary.
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
/// <param name="extends"></param>
/// <param name="items"></param>
[PublicAPI]
public static void AddRange<TKey, TValue>(this IDictionary<TKey, TValue> extends, IEnumerable<KeyValuePair<TKey, TValue>> items)
{
if (extends == null)
throw new ArgumentNullException("extends");
if (items == null)
throw new ArgumentNullException("items");
foreach (KeyValuePair<TKey, TValue> item in items)
extends.Add(item);
}
/// <summary>
/// Adds the sequence of items to the dictionary.
/// </summary>