Method ToLookup
ToLookup<TKey, TValue>(IReadOnlyCollectionDictionary<TKey, TValue>, IEqualityComparer<TKey>?)
Creates a snapshot ILookup<TKey, TElement> by copying the current contents of the collection dictionary. Subsequent changes to the dictionary are not reflected in the returned lookup.
Declaration
public static ILookup<TKey, TValue> ToLookup<TKey, TValue>(this IReadOnlyCollectionDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey>? keyComparer = null) where TKey : notnull
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyCollectionDictionary<TKey, TValue> | dictionary | The dictionary to snapshot. |
| IEqualityComparer<TKey> | keyComparer | The key comparer to use for the returned lookup, or null to use the default comparer. This does not default to the comparer used by the source dictionary. |
Returns
| Type | Description |
|---|---|
| ILookup<TKey, TValue> |
Type Parameters
| Name | Description |
|---|---|
| TKey | |
| TValue |
ToLookup<TKey, TValue>(IReadOnlyListDictionary<TKey, TValue>, IEqualityComparer<TKey>?)
Creates a snapshot ILookup<TKey, TElement> by copying the current contents of the collection dictionary. Subsequent changes to the dictionary are not reflected in the returned lookup.
Declaration
public static ILookup<TKey, TValue> ToLookup<TKey, TValue>(this IReadOnlyListDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey>? keyComparer = null) where TKey : notnull
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyListDictionary<TKey, TValue> | dictionary | The dictionary to snapshot. |
| IEqualityComparer<TKey> | keyComparer | The key comparer to use for the returned lookup, or null to use the default comparer. This does not default to the comparer used by the source dictionary. |
Returns
| Type | Description |
|---|---|
| ILookup<TKey, TValue> |
Type Parameters
| Name | Description |
|---|---|
| TKey | |
| TValue |
ToLookup<TKey, TValue>(IReadOnlySetDictionary<TKey, TValue>, IEqualityComparer<TKey>?)
Creates a snapshot ILookup<TKey, TElement> by copying the current contents of the collection dictionary. Subsequent changes to the dictionary are not reflected in the returned lookup.
Declaration
public static ILookup<TKey, TValue> ToLookup<TKey, TValue>(this IReadOnlySetDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey>? keyComparer = null) where TKey : notnull
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlySetDictionary<TKey, TValue> | dictionary | The dictionary to snapshot. |
| IEqualityComparer<TKey> | keyComparer | The key comparer to use for the returned lookup, or null to use the default comparer. This does not default to the comparer used by the source dictionary. |
Returns
| Type | Description |
|---|---|
| ILookup<TKey, TValue> |
Type Parameters
| Name | Description |
|---|---|
| TKey | |
| TValue |