Click or drag to resize

ExtensionMethods.ToDictionaryIgnoringDuplicates<TSource, TKey, TElement> Method (IEnumerable<TSource>, Func<TSource, TKey>, Func<TSource, TElement>)

Namespace:  SanteDB.Core
Assembly:  SanteDB.Core.Api (in SanteDB.Core.Api.dll) Version: 3.0.481-alpha
Syntax
public static Dictionary<TKey, TElement> ToDictionaryIgnoringDuplicates<TSource, TKey, TElement>(
	this IEnumerable<TSource> source,
	Func<TSource, TKey> keySelector,
	Func<TSource, TElement> valueSelector
)

Parameters

source
Type: System.Collections.Generic.IEnumerable<TSource>
An IEnumerable<T> to create a Dictionary<TKey, TValue> from.
keySelector
Type: System.Func<TSource, TKey>
A function to extract a key from each element.
valueSelector
Type: System.Func<TSource, 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

Type: Dictionary<TKey, TElement>
A Dictionary<TKey, 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 IEnumerable<TSource>. 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