mirror of
https://github.com/mgroves/MonodroidStockPortfolio.git
synced 2024-12-29 11:17:07 +00:00
20 lines
558 B
C#
20 lines
558 B
C#
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace MonoStockPortfolio.Core
|
||
|
{
|
||
|
public static class DictionaryExtensions
|
||
|
{
|
||
|
public static void AddRange<T, U>(this IDictionary<T, U> D, IEnumerable<KeyValuePair<T, U>> V)
|
||
|
{
|
||
|
foreach (var kvp in V)
|
||
|
{
|
||
|
if (D.ContainsKey(kvp.Key))
|
||
|
{
|
||
|
throw new ArgumentException("An item with the same key has already been added.");
|
||
|
}
|
||
|
D.Add(kvp);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|