mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
feat: IcdOrderedDictionary exposes constructor with equality comparer
This commit is contained in:
parent
86335e0d44
commit
84fa69d3e0
1 changed files with 14 additions and 1 deletions
|
|
@ -60,13 +60,26 @@ namespace ICD.Common.Utils.Collections
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="comparer"></param>
|
/// <param name="comparer"></param>
|
||||||
public IcdOrderedDictionary(IComparer<TKey> comparer)
|
public IcdOrderedDictionary(IComparer<TKey> comparer)
|
||||||
|
: this(comparer, EqualityComparer<TKey>.Default)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
/// <param name="equalityComparer"></param>
|
||||||
|
public IcdOrderedDictionary(IComparer<TKey> comparer, IEqualityComparer<TKey> equalityComparer)
|
||||||
{
|
{
|
||||||
if (comparer == null)
|
if (comparer == null)
|
||||||
throw new ArgumentNullException("comparer");
|
throw new ArgumentNullException("comparer");
|
||||||
|
|
||||||
|
if (equalityComparer == null)
|
||||||
|
throw new ArgumentNullException("equalityComparer");
|
||||||
|
|
||||||
m_Comparer = comparer;
|
m_Comparer = comparer;
|
||||||
m_OrderedKeys = new List<TKey>();
|
m_OrderedKeys = new List<TKey>();
|
||||||
m_Dictionary = new Dictionary<TKey, TValue>();
|
m_Dictionary = new Dictionary<TKey, TValue>(equalityComparer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue