 | ExtensionMethodsToDictionaryIgnoringDuplicatesTSource, TKey, TElement(IEnumerableTSource, FuncTSource, TKey, FuncTSource, TElement) Method |
Creates a
DictionaryTKey, TValue from an
IEnumerableT
according to specified key selector and element selector functions. Diplicate keys will not be added to the dictionary.
Namespace: SanteDBAssembly: SanteDB.Core.Model (in SanteDB.Core.Model.dll) Version: 3.0.2081-alpha+0a330d5f5a5d3cb3e6e945ef530e94ac5671b49c
Syntaxpublic static Dictionary<TKey, TElement> ToDictionaryIgnoringDuplicates<TSource, TKey, TElement>(
this IEnumerable<TSource> source,
Func<TSource, TKey> keySelector,
Func<TSource, TElement> valueSelector
)
<ExtensionAttribute>
Public Shared Function ToDictionaryIgnoringDuplicates(Of TSource, TKey, TElement) (
source As IEnumerable(Of TSource),
keySelector As Func(Of TSource, TKey),
valueSelector As Func(Of TSource, TElement)
) As Dictionary(Of TKey, TElement)
public:
[ExtensionAttribute]
generic<typename TSource, typename TKey, typename TElement>
static Dictionary<TKey, TElement>^ ToDictionaryIgnoringDuplicates(
IEnumerable<TSource>^ source,
Func<TSource, TKey>^ keySelector,
Func<TSource, TElement>^ valueSelector
)
[<ExtensionAttribute>]
static member ToDictionaryIgnoringDuplicates :
source : IEnumerable<'TSource> *
keySelector : Func<'TSource, 'TKey> *
valueSelector : Func<'TSource, 'TElement> -> Dictionary<'TKey, 'TElement> Parameters
- source IEnumerableTSource
- An IEnumerableT to create a DictionaryTKey, TValue from.
- keySelector FuncTSource, TKey
- A function to extract a key from each element.
- valueSelector FuncTSource, TElement
- A transform function to produce a result element value from each element.
Type Parameters
- TSource
- The type of the elements of source.
- TKey
- The type of the key returned by keySelector.
- TElement
- The type of the value returned by elementSelector.
Return Value
DictionaryTKey,
TElement
A
DictionaryTKey, TValue that contains values of type
TElement selected from the input sequence.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableTSource. 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