mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +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;
|
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>
|
/// <summary>
|
||||||
/// Adds the sequence of items to the dictionary.
|
/// Adds the sequence of items to the dictionary.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user