mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-13 20:47:24 +00:00
feat: IcdHashSet constructor overloads for IEqualityComparer param
This commit is contained in:
parent
957424e5ca
commit
8871fad40a
1 changed files with 26 additions and 3 deletions
|
|
@ -46,8 +46,8 @@ namespace ICD.Common.Utils.Collections
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IcdHashSet()
|
public IcdHashSet()
|
||||||
|
: this(Enumerable.Empty<T>())
|
||||||
{
|
{
|
||||||
m_Dict = new Dictionary<T, object>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -55,10 +55,33 @@ namespace ICD.Common.Utils.Collections
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="items"></param>
|
/// <param name="items"></param>
|
||||||
public IcdHashSet(IEnumerable<T> items)
|
public IcdHashSet(IEnumerable<T> items)
|
||||||
: this()
|
: this(EqualityComparer<T>.Default, items)
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
public IcdHashSet(IEqualityComparer<T> comparer)
|
||||||
|
: this(comparer, Enumerable.Empty<T>())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
/// <param name="items"></param>
|
||||||
|
public IcdHashSet(IEqualityComparer<T> comparer, IEnumerable<T> items)
|
||||||
|
{
|
||||||
|
if (comparer == null)
|
||||||
|
throw new ArgumentNullException("comparer");
|
||||||
|
|
||||||
if (items == null)
|
if (items == null)
|
||||||
return;
|
throw new ArgumentNullException("items");
|
||||||
|
|
||||||
|
m_Dict = new Dictionary<T, object>(comparer);
|
||||||
|
|
||||||
AddRange(items);
|
AddRange(items);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue