mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-11 02:35:05 +00:00
feat: Extension method for populating a dict with a sequence of kvps
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user