Method
ToMap
func ToMap<T, K, V>(keySelector: (T) -> K, valueSelector: (T) -> V, comparer: EqualityComparer<K>) -> HashMap<K, V>
Declaring type: Operators
Module: System.Linq
Assembly: System.Runtime.dll
Extension from Operators.ToMap
Materializes selected keys and values into a new map.
Parameters
| Name | Type | Description |
|---|---|---|
self |
Iterable<T> | Input to enumerate once. |
keySelector |
Function | Key selector, invoked once per visited element before the value selector. |
valueSelector |
Function | Value selector, invoked once per visited element. |
comparer |
EqualityComparer<K> | Explicit stable key equality and hash policy. |
Return value
HashMap<K, V>
A new shallow map; empty for empty input.
Remarks
Native development API. Eager and single-pass. Duplicate keys cause a terminal Fault after iterator disposal. Provider/callback Faults do not guarantee cleanup or rollback. No concurrent snapshot guarantee.