mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +00:00
Optimization in adding multiple items to an IcdHashSet
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user