Share via


DictionaryExtensions.ToDictionaryNicely Method

This element is introduced in Windows PowerShell 5.0.

Namespace: Microsoft.OneGet.Utility.Extensions
Assembly: Microsoft.OneGet.Utility (in Microsoft.OneGet.Utility.dll)

Usage

'Usage
Dim source As IEnumerable(Of TSource)
Dim keySelector As Func(Of TSource, TKey)
Dim elementSelector As Func(Of TSource, TElement)
Dim comparer As IEqualityComparer(Of TKey)
Dim returnValue As Dictionary(Of TKey, TElement)

returnValue = DictionaryExtensions.ToDictionaryNicely(source, keySelector, elementSelector, comparer)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function ToDictionaryNicely(Of TSource, TKey, TElement) ( _
    source As IEnumerable(Of TSource), _
    keySelector As Func(Of TSource, TKey), _
    elementSelector As Func(Of TSource, TElement), _
    comparer As IEqualityComparer(Of TKey) _
) As Dictionary(Of TKey, TElement)
[ExtensionAttribute] 
public static Dictionary<TKey,TElement> ToDictionaryNicely<TSource,TKey,TElement> (
    IEnumerable<TSource> source,
    Func<TSource,TKey> keySelector,
    Func<TSource,TElement> elementSelector,
    IEqualityComparer<TKey> comparer
)
[ExtensionAttribute] 
public:
generic<typename TSource, typename TKey, typename TElement>
static Dictionary<TKey, TElement>^ ToDictionaryNicely (
    IEnumerable<TSource>^ source, 
    Func<TSource, TKey>^ keySelector, 
    Func<TSource, TElement>^ elementSelector, 
    IEqualityComparer<TKey>^ comparer
)

GenericParameters

  • TSource
  • TKey
  • TElement

Parameters

  • source
  • keySelector
  • elementSelector
  • comparer

Return Value

Returns Dictionary.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Target Platforms

See Also

Reference

DictionaryExtensions Class
DictionaryExtensions Members
Microsoft.OneGet.Utility.Extensions Namespace