mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 03:57:32 +00:00
Optimization in adding multiple items to an IcdHashSet
This commit is contained in:
parent
db66fc40cf
commit
201e0878c7
1 changed files with 12 additions and 1 deletions
|
|
@ -192,8 +192,19 @@ namespace ICD.Common.Utils.Collections
|
||||||
/// <param name="items"></param>
|
/// <param name="items"></param>
|
||||||
public void AddRange(IEnumerable<T> items)
|
public void AddRange(IEnumerable<T> items)
|
||||||
{
|
{
|
||||||
|
if (items == null)
|
||||||
|
throw new ArgumentNullException("items");
|
||||||
|
|
||||||
foreach (T item in items)
|
foreach (T item in items)
|
||||||
Add(item);
|
{
|
||||||
|
// ReSharper disable CompareNonConstrainedGenericWithNull
|
||||||
|
if (item == null)
|
||||||
|
// ReSharper restore CompareNonConstrainedGenericWithNull
|
||||||
|
throw new InvalidOperationException("item");
|
||||||
|
|
||||||
|
if (!m_Dict.ContainsKey(item))
|
||||||
|
m_Dict[item] = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue