Class Map<TLeft, TRight>
Represents a collection of two types of values that map between each other in a bidirectional one-to-one relationship. Values on each side of the map must be unique on their respective side.
Implements
Namespace: Singulink.Collections
Assembly: Singulink.Collections.dll
Syntax
public class Map<TLeft, TRight> : IMap<TLeft, TRight>, IReadOnlyMap<TLeft, TRight>, IDictionary<TLeft, TRight>, ICollection<KeyValuePair<TLeft, TRight>>, IReadOnlyDictionary<TLeft, TRight>, IReadOnlyCollection<KeyValuePair<TLeft, TRight>>, IEnumerable<KeyValuePair<TLeft, TRight>>, IEnumerable where TLeft : notnull where TRight : notnullType Parameters
| Name | Description | 
|---|---|
| TLeft | The type of values on the left side of the map. | 
| TRight | The type of values on the right side of the map. | 
Constructors
| Name | Description | 
|---|---|
| Map() | Initializes a new instance of the Map<TLeft, TRight> class. | 
| Map(IEqualityComparer<TLeft>?, IEqualityComparer<TRight>?) | Initializes a new instance of the Map<TLeft, TRight> class with the specified value comparers. | 
| Map(int) | Initializes a new instance of the Map<TLeft, TRight> class with the specified capacity. | 
| Map(int, IEqualityComparer<TLeft>?, IEqualityComparer<TRight>?) | Initializes a new instance of the Map<TLeft, TRight> class with the specified capacity and value comparers. | 
Properties
| Name | Description | 
|---|---|
| Count | Gets the number of mappings contained in the map. | 
| this[TLeft] | Gets or sets the right value associated with the specified left value. | 
| LeftComparer | Gets the equality comparer used to compare left values in the map. | 
| LeftValues | Gets the values on the left side of the map. | 
| Reverse | Gets the reverse map where the left and right side are flipped. | 
| RightComparer | Gets the equality comparer used to compare right values in the map. | 
| RightValues | Gets the values on the right side of the map. | 
Methods
| Name | Description | 
|---|---|
| Add(TLeft, TRight) | Adds an association to map between the specified left and right value. | 
| Clear() | Removes all mappings from the map. | 
| Contains(TLeft, TRight) | Determines whether this map contains an association between the specified left and right value. | 
| ContainsLeft(TLeft) | Determines whether this map contains the specified left value. | 
| ContainsRight(TRight) | Determines whether this map contains the specified right value. | 
| EnsureCapacity(int) | Ensures that this map can hold up to a specified number of entries without any further expansion of its backing storage. | 
| GetAlternateLeftLookup<TAlternateLeft>() | Gets an alternate lookup that can be used to perform operations on this map using  | 
| GetAlternateLookup<TAlternateLeft, TAlternateRight>() | Gets an alternate lookup that can be used to perform operations on this map using  | 
| GetEnumerator() | Returns an enumerator that iterates through the left and right value pairs. | 
| GetLeftValue(TRight) | Gets the left value associated with the specified right value. | 
| Remove(TLeft, TRight) | Removes an association from the map between the specified left and right value if they currently map to each other. | 
| RemoveLeft(TLeft) | Removes an association from the map given the specified left value. | 
| RemoveLeft(TLeft, out TRight) | Removes an association from the map given the specified left value. | 
| RemoveRight(TRight) | Removes an association from the map given the specified right value. | 
| RemoveRight(TRight, out TLeft) | Removes an association from the map given the specified right value. | 
| Set(TLeft, TRight) | Sets an association in the map between the specified left and right value, overriding any existing associations these values had. | 
| TrimExcess() | Sets the capacity of this map to what it would be if it had been originally initialized with all its entries. | 
| TrimExcess(int) | Sets the capacity of this map to hold up a specified number of entries without any further expansion of its backing storage. | 
| TryAdd(TLeft, TRight) | Attempts to add an association to map between the specified left and right value. | 
| TryGetAlternateLeftLookup<TAlternateLeft>(out AlternateLeftLookup<TAlternateLeft>) | Gets an alternate lookup that can be used to perform operations on this map using  | 
| TryGetAlternateLookup<TAlternateLeft, TAlternateRight>(out AlternateLookup<TAlternateLeft, TAlternateRight>) | Gets an alternate lookup that can be used to perform operations on this map using  | 
| TryGetLeftValue(TRight, out TLeft) | Gets the right value associated with the specified left value. | 
| TryGetRightValue(TLeft, out TRight) | Gets the right value associated with the specified left value. | 
Explicit Interface Implementations
| Name | Description | 
|---|---|
| IMap<TLeft, TRight>.LeftValues | Gets the values on the left side of the map. | 
| IMap<TLeft, TRight>.Reverse | Gets the reverse map where the left and right side are flipped. | 
| IMap<TLeft, TRight>.RightValues | Gets the values on the right side of the map. | 
| IReadOnlyMap<TLeft, TRight>.LeftValues | Gets the values on the left side of the map. | 
| IReadOnlyMap<TLeft, TRight>.Reverse | Gets the reverse map where the left and right side are flipped. | 
| IReadOnlyMap<TLeft, TRight>.RightValues | Gets the values on the right side of the map. | 
| ICollection<KeyValuePair<TLeft, TRight>>.Add(KeyValuePair<TLeft, TRight>) | Adds an association to map between the specified left and right value. | 
| ICollection<KeyValuePair<TLeft, TRight>>.Contains(KeyValuePair<TLeft, TRight>) | Determines whether this map contains an association between the specified left and right value. | 
| ICollection<KeyValuePair<TLeft, TRight>>.CopyTo(KeyValuePair<TLeft, TRight>[], int) | Copies the left and right value pairs to an array starting at the specified array index. | 
| ICollection<KeyValuePair<TLeft, TRight>>.IsReadOnly | Gets a value indicating whether the collection is read-only. Always returns false. | 
| ICollection<KeyValuePair<TLeft, TRight>>.Remove(KeyValuePair<TLeft, TRight>) | Removes an association from the map between the specified left and right value if they currently map to each other. | 
| IDictionary<TLeft, TRight>.ContainsKey(TLeft) | Determines whether this map contains the specified left value. | 
| IDictionary<TLeft, TRight>.Keys | Gets the values on the left side of the map. | 
| IDictionary<TLeft, TRight>.Remove(TLeft) | Removes an association from the map given the specified left value. | 
| IDictionary<TLeft, TRight>.TryGetValue(TLeft, out TRight) | Gets the right value associated with the specified left value. | 
| IDictionary<TLeft, TRight>.Values | Gets the values on the right side of the map. | 
| IEnumerable<KeyValuePair<TLeft, TRight>>.GetEnumerator() | Returns an enumerator that iterates through the left and right value pairs. | 
| IReadOnlyDictionary<TLeft, TRight>.ContainsKey(TLeft) | Determines whether this map contains the specified left value. | 
| IReadOnlyDictionary<TLeft, TRight>.Keys | Gets the values on the left side of the map. | 
| IReadOnlyDictionary<TLeft, TRight>.TryGetValue(TLeft, out TRight) | Gets the right value associated with the specified left value. | 
| IReadOnlyDictionary<TLeft, TRight>.Values | Gets the values on the right side of the map. | 
| IEnumerable.GetEnumerator() | Returns an enumerator that iterates through the left and right value pairs. | 
