Click or drag to resize

CollectionExtensionsDistinctByTSource, TKey Method

Returns only the elements whose keys are distinct.

Namespace: GSF.Collections
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.181-beta
Syntax
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(
	this IEnumerable<TSource> source,
	Func<TSource, TKey> keySelector,
	bool forwardSearch = true
)
View Source

Parameters

source  IEnumerableTSource
The collection of source objects.
keySelector  FuncTSource, TKey
The function used to access the keys of the source objects.
forwardSearch  Boolean  (Optional)
true to search forward in source; otherwise false to search backwards.

Type Parameters

TSource
The type of the source objects in the collection.
TKey
The type of the keys to be compared.

Return Value

IEnumerableTSource
The elements from source whose keys are distinct.

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