Class DictionaryConverter
This utility class is designed to make System.Collections.Generic.IDictionary<TKey, TValue> related conversions easier to work with.
Inheritance
Namespace: Cuemon.Collections.Generic
Assembly: Cuemon.Core.dll
Syntax
public static class DictionaryConverter
Methods
| Improve this DocFromEnumerable<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>>)
Creates a System.Collections.Generic.Dictionary<TKey, TValue> from the specified source sequence.
Declaration
public static IDictionary<TKey, TValue> FromEnumerable<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>> source)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>> | source | The sequence to create a System.Collections.Generic.Dictionary<TKey, TValue> from. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IDictionary<TKey, TValue> | A System.Collections.Generic.Dictionary<TKey, TValue> that is equivalent to the specified |
Type Parameters
| Name | Description |
|---|---|
| TKey | The type of keys in the |
| TValue | The type of values in the |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
| System.ArgumentException |
|
FromEnumerable<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>>, IEqualityComparer<TKey>)
Creates a System.Collections.Generic.Dictionary<TKey, TValue> from the specified source sequence.
Declaration
public static IDictionary<TKey, TValue> FromEnumerable<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>> source, IEqualityComparer<TKey> comparer)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>> | source | The sequence to create a System.Collections.Generic.Dictionary<TKey, TValue> from. |
| System.Collections.Generic.IEqualityComparer<TKey> | comparer | The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing keys. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IDictionary<TKey, TValue> | A System.Collections.Generic.Dictionary<TKey, TValue> that is equivalent to the specified |
Type Parameters
| Name | Description |
|---|---|
| TKey | The type of keys in the |
| TValue | The type of values in the |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
| System.ArgumentException |
|