MonodroidStockPortfolio/MonoStockPortfolio.Core/DictionaryExtensions.cs
2010-11-02 12:26:36 -04:00

20 lines
No EOL
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);
}
}
}
}