IEnumerableExtensionsDistinctByTSource, TKey(IEnumerableTSource, FuncTSource, TKey) Method

Returns distinct elements from a sequence by using a specified key selector and the default equality comparer to compare values.

Definition

Namespace: DevCase.Extensions.IEnumerableExtensions
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[EditorBrowsableAttribute(EditorBrowsableState.Always)]
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(
	this IEnumerable<TSource> sequence,
	Func<TSource, TKey> selector
)

Parameters

sequence  IEnumerableTSource
The sequence to remove duplicate elements from.
selector  FuncTSource, TKey
A transform function to apply to each element.

Type Parameters

TSource
The type of the sequence.
TKey
The type of the key to compare.

Return Value

IEnumerableTSource
The resulting IEnumerableT.

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