Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ToImmutableDictionary< TSource, TKey, TValue >() [3/3]

static ImmutableDictionary< TKey, TValue > System.Collections.Immutable.ImmutableDictionary< TKey, TValue >.ToImmutableDictionary< TSource, TKey, TValue > ( this IEnumerable< TSource > source,
Func< TSource, TKey > keySelector,
Func< TSource, TValue > elementSelector,
IEqualityComparer< TKey >? keyComparer,
IEqualityComparer< TValue >? valueComparer )
inlinestatic
Type Constraints
TKey :notnull 

Definition at line 56 of file ImmutableDictionary.cs.

56 : notnull
57 {
60 Requires.NotNull(source, "source");
61 Requires.NotNull(keySelector2, "keySelector");
62 Requires.NotNull(elementSelector2, "elementSelector");
63 return ImmutableDictionary<TKey, TValue>.Empty.WithComparers(keyComparer, valueComparer).AddRange(source.Select((TSource element) => new KeyValuePair<TKey, TValue>(keySelector2(element), elementSelector2(element))));
64 }
void AddRange(IEnumerable< KeyValuePair< TKey, TValue > > collection)

References System.Collections.Generic.Dictionary< TKey, TValue >.AddRange(), System.Linq.elementSelector, System.Linq.keySelector, and System.source.