ExtensionMethodsToMultiValueDictionaryTKey, TValue Method |
Converts an enumerable into a MultiValueDictionary. Similar to ToDictionary however this time the returned type is a MultiValueDictionary.
Namespace:
SD.Tools.Algorithmia.GeneralDataStructures
Assembly:
SD.Tools.Algorithmia (in SD.Tools.Algorithmia.dll) Version: 1.2.0.0 (1.2.16.0406)
Syntax public static MultiValueDictionary<TKey, TValue> ToMultiValueDictionary<TKey, TValue>(
this IEnumerable<TValue> source,
Func<TValue, TKey> keySelectorFunc
)
<ExtensionAttribute>
Public Shared Function ToMultiValueDictionary(Of TKey, TValue) (
source As IEnumerable(Of TValue),
keySelectorFunc As Func(Of TValue, TKey)
) As MultiValueDictionary(Of TKey, TValue)
Parameters
- source
- Type: System.Collections.GenericIEnumerableTValue
The source. - keySelectorFunc
- Type: SystemFuncTValue, TKey
The key selector func.
Type Parameters
- TKey
- The type of the key.
- TValue
- The type of the value.
Return Value
Type:
MultiValueDictionaryTKey,
TValueMultiValueDictionary with the values of source stored under the keys retrieved by the keySelectorFunc which is applied to each
value in source, or null if source is null
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableTValue. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also