Class ReadOnlyMap<TLeft, TRight>
Represents a read-only bidirectional one-to-one mapping between two sets of values. Values on each side of the map must be unique within their respective side.
Implements
Namespace: Singulink.Collections
Assembly: Singulink.Collections.dll
Syntax
public class ReadOnlyMap<TLeft, TRight> : IMap<TLeft, TRight>, IReadOnlyMap<TLeft, TRight>, IReadOnlyCollection<KeyValuePair<TLeft, TRight>>, ICollection<KeyValuePair<TLeft, TRight>>, IEnumerable<KeyValuePair<TLeft, TRight>>, IEnumerable where TLeft : notnull where TRight : notnull
Type 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 |
|---|---|
| ReadOnlyMap(Map<TLeft, TRight>) | Initializes a new instance of the ReadOnlyMap<TLeft, TRight> class. |
Properties
| Name | Description |
|---|---|
| Count | Gets the number of associations in the map. |
| this[TLeft] | Gets the right value associated with the specified left value. |
| LeftValues | Gets a collection containing the values on the left side of the map. |
| Reverse | Gets a view of this map with the left and right sides swapped. |
| RightValues | Gets a collection containing the values on the right side of the map. |
Methods
| Name | Description |
|---|---|
| Contains(TLeft, TRight) | Determines whether the map contains an association between the specified left and right values. |
| ContainsLeft(TLeft) | Determines whether the map contains the specified left value. |
| ContainsRight(TRight) | Determines whether the map contains the specified right value. |
| GetEnumerator() | Returns an enumerator that iterates through the left and right value pairs in the map. |
| TryGetLeftValue(TRight, out TLeft) | Attempts to get the left value associated with the specified right value. |
| TryGetRightValue(TLeft, out TRight) | Attempts to get the right value associated with the specified left value. |