Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: Dictionary<TKey, TValue> ToDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>>, IEqualityComparer<TKey>, bool)

Declaration

public static Dictionary<TKey, TValue> ToDictionary<TKey, TValue>(
    this IEnumerable<KeyValuePair<TKey, TValue>> source,
    IEqualityComparer<TKey> comparer = null,
    bool ignoreDuplicateKeys = false
)

Summary

Converts an IEnumerable<KeyValuePair<TKey, TValue>> into a Dictionary<TKey, TValue>.

Generic type parameters

TKeyThis type parameter is not documented.
TValueThis type parameter is not documented.

Parameters

this IEnumerable<KeyValuePair<TKey, TValue>>source Source collection to convert to a dictionary.
IEqualityComparer<TKey>comparer An optional equality comparer to compare keys.
boolignoreDuplicateKeys If true, duplicate keys are ignored and only their first occurrence added to the dictionary. Otherwise, a duplicate key causes an exception.