mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 20:54:58 +00:00
feat: Adding constructor to BiDictionary to build from an existing dict
This commit is contained in:
@@ -30,9 +30,24 @@ namespace ICD.Common.Utils.Collections
|
|||||||
/// Constructor.
|
/// Constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BiDictionary()
|
public BiDictionary()
|
||||||
|
: this(null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dict"></param>
|
||||||
|
public BiDictionary(Dictionary<TKey, TValue> dict)
|
||||||
{
|
{
|
||||||
m_KeyToValue = new Dictionary<TKey, TValue>();
|
m_KeyToValue = new Dictionary<TKey, TValue>();
|
||||||
m_ValueToKey = new Dictionary<TValue, TKey>();
|
m_ValueToKey = new Dictionary<TValue, TKey>();
|
||||||
|
|
||||||
|
if (dict == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (KeyValuePair<TKey, TValue> kvp in dict)
|
||||||
|
Add(kvp.Key, kvp.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|||||||
Reference in New Issue
Block a user