mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +00:00
feat: IcdOrderedDictionary exposes constructor with equality comparer
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user