AsyncEnumerable.Distinct<TSource> Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Returns distinct elements from a sequence.

C#
public static System.Collections.Generic.IAsyncEnumerable<TSource> Distinct<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, System.Collections.Generic.IEqualityComparer<TSource>? comparer = default);

Type Parameters

TSource

Parameters

source
IAsyncEnumerable<TSource>

The sequence to remove duplicate elements from.

comparer
IEqualityComparer<TSource>

An IEqualityComparer<T> to compare values.

Returns

IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> that contains distinct elements from the source sequence.

Exceptions

source is null.

Applies to

Produkt Versioner
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided), 10
.NET Standard 2.0 (package-provided)