ImmutableDictionary::ToImmutableDictionary<TSource, TKey> Method (IEnumerable<TSource>^, Func<TSource, TKey>^)
Constructs an immutable dictionary from an existing collection of elements, applying a transformation function to the source keys.
Assembly: System.Collections.Immutable (in System.Collections.Immutable.dll)
public: generic<typename TSource, typename TKey> [ExtensionAttribute] static ImmutableDictionary<TKey, TSource>^ ToImmutableDictionary( IEnumerable<TSource>^ source, Func<TSource, TKey>^ keySelector )
Parameters
- source
-
Type:
System.Collections.Generic::IEnumerable<TSource>^
The source collection used to generate the immutable dictionary.
- keySelector
-
Type:
System::Func<TSource, TKey>^
The function used to transform keys for the immutable dictionary.
Return Value
Type: System.Collections.Immutable::ImmutableDictionary<TKey, TSource>^The immutable dictionary that contains elements from source, with keys transformed by applying keySelector.
Type Parameters
- TSource
The type of element in the source collection.
- TKey
The type of key in the resulting immutable dictionary.
Show: