Open sandboxFocus

Method ToAdvisableDictionary

ToAdvisableDictionary<TKey, TValue>(IDictionary<TKey, TValue>)

Declaration
public static AdvisableDictionary<TKey, TValue> ToAdvisableDictionary<TKey, TValue>(this IDictionary<TKey, TValue> dictionary)
Parameters
Type Name Description
IDictionary<TKey, TValue> dictionary

An IDictionary<TKey, TValue>, or null.

Returns
Type Description
AdvisableDictionary<TKey, TValue>

A new AdvisableDictionary<TKey, TValue> containing all elements of dictionary, or null if dictionary is empty.

Type Parameters
Name Description
TKey

Type of dictionary keys.

TValue

Type of dictionary values.

ToAdvisableDictionary<TItem, TKey, TValue>(IEnumerable<TItem>, Func<TItem, TKey>, Func<TItem, TValue>)

Converts an IEnumerable<T> into a AdvisableDictionary<TKey, TValue> given a method returning the item key and a method returning the item value.

Declaration
public static AdvisableDictionary<TKey, TValue> ToAdvisableDictionary<TItem, TKey, TValue>(this IEnumerable<TItem> collection, Func<TItem, TKey> getKeyFunc, Func<TItem, TValue> getValueFunc)
Parameters
Type Name Description
IEnumerable<TItem> collection

An IEnumerable<T>, or null.

Func<TItem, TKey> getKeyFunc

A method returning the dictionary key given an item of the input collection.

Func<TItem, TValue> getValueFunc

A method returning the dictionary value given an item of the input collection.

Returns
Type Description
AdvisableDictionary<TKey, TValue>

A new AdvisableDictionary<TKey, TValue> build from items of the input collection, or null if collection is null.

Type Parameters
Name Description
TItem

Type of items in the input collection.

TKey

Type of keys in the output dictionary.

TValue

Type of values in the output dictionary.