public static Dictionary <TKey, TSource> ToDictionary <TSource, TKey>(this TSource[] source, Func <TSource, TKey> keySelector, IEqualityComparer <TKey> comparer = null) { var aggregate = new ToDictionary <TSource, TKey>(keySelector, comparer); ArrayNode.ProcessArray(source, ref aggregate); return(aggregate.GetResult()); }
public static Dictionary <TKey, TValue> ToDictionary <TSource, TKey, TValue>(this ReadOnlyMemory <TSource> source, Func <TSource, TKey> keySelector, Func <TSource, TValue> elementSelector, IEqualityComparer <TKey> comparer = null) { var aggregate = new ToDictionary <TSource, TKey, TValue>(keySelector, elementSelector, comparer); MemoryNode.ProcessMemory(source, ref aggregate); return(aggregate.GetResult()); }