ImmutableDictionary::ToImmutableDictionary<TSource, TKey> Method (IEnumerable<TSource>^, Func<TSource, TKey>^, IEqualityComparer<TKey>^)

 

Constructs an immutable dictionary based on some transformation of a sequence.

Namespace:   System.Collections.Immutable
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,
	IEqualityComparer<TKey>^ keyComparer
)

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.

keyComparer
Type: System.Collections.Generic::IEqualityComparer<TKey>^

The key comparer to use for the 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.

Return to top
Show: