Extensions.ToAdvisableDictionary<TItem, TKey, TValue> Method (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.
Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.9.1.0 (6.9.1.0)
C#
public static AdvisableDictionary<TKey, TValue> ToAdvisableDictionary<TItem, TKey, TValue>( this IEnumerable<TItem> collection, Func<TItem, TKey> getKeyFunc, Func<TItem, TValue> getValueFunc )
Parameters
- collection
- Type: System.Collections.Generic.IEnumerable<TItem>
An IEnumerable<T>, or null. - getKeyFunc
- Type: System.Func<TItem, TKey>
A method returning the dictionary key given an item of the input collection. - getValueFunc
- Type: System.Func<TItem, TValue>
A method returning the dictionary value given an item of the input collection.
Type Parameters
- TItem
- Type of items in the input collection.
- TKey
- Type of keys in the output dictionary.
- TValue
- Type of values in the output dictionary.
Return Value
Type: AdvisableDictionary<TKey, TValue>A new AdvisableDictionary<TKey, TValue> build from items of the input collection, or null if collection is null.