Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Method

ToMap

func ToMap<K, V>(comparer: EqualityComparer<K>) -> HashMap<K, V>

Declaring type: MapOperators
Module: System.Linq
Assembly: System.Runtime.dll

Extension from MapOperators.ToMap

Copies pairs into a new map using an explicit key comparer.

Parameters

Name Type Description
self Iterable<KeyValuePair<K, V>> Pairs to enumerate once.
comparer EqualityComparer<K> Explicit stable key equality and hash policy.

Return value

HashMap<K, V>

An independently stored shallow map; empty for empty input.

Remarks

Native development API. Eager. Duplicate keys cause a terminal Fault after iterator disposal. Provider/comparer Faults do not guarantee cleanup. Source policy is not inferred. No concurrent snapshot guarantee.