Method DistinctUntilChanged
View SourceDistinctUntilChanged<TSource>(IAsyncEnumerable<TSource>)
Returns consecutive distinct elements by using the default equality comparer to compare values.
Declaration
public static IAsyncEnumerable<TSource> DistinctUntilChanged<TSource>(this IAsyncEnumerable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | Source sequence. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TSource> | Sequence without adjacent non-distinct elements. |
Type Parameters
Name | Description |
---|---|
TSource | Source sequence element type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
DistinctUntilChanged<TSource>(IAsyncEnumerable<TSource>, IEqualityComparer<TSource>?)
Returns consecutive distinct elements by using the specified equality comparer to compare values.
Declaration
public static IAsyncEnumerable<TSource> DistinctUntilChanged<TSource>(this IAsyncEnumerable<TSource> source, IEqualityComparer<TSource>? comparer)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | Source sequence. |
IEqualityComparer<TSource> | comparer | Comparer used to compare values. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TSource> | Sequence without adjacent non-distinct elements. |
Type Parameters
Name | Description |
---|---|
TSource | Source sequence element type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
DistinctUntilChanged<TSource, TKey>(IAsyncEnumerable<TSource>, Func<TSource, TKey>)
Returns consecutive distinct elements based on a key value by using the specified equality comparer to compare key values.
Declaration
public static IAsyncEnumerable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | Source sequence. |
Func<TSource, TKey> | keySelector | Key selector. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TSource> | Sequence without adjacent non-distinct elements. |
Type Parameters
Name | Description |
---|---|
TSource | Source sequence element type. |
TKey | Key type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
DistinctUntilChanged<TSource, TKey>(IAsyncEnumerable<TSource>, Func<TSource, ValueTask<TKey>>)
Returns consecutive distinct elements based on a key value by using the specified equality comparer to compare key values.
Declaration
public static IAsyncEnumerable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | Source sequence. |
Func<TSource, ValueTask<TKey>> | keySelector | Key selector. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TSource> | Sequence without adjacent non-distinct elements. |
Type Parameters
Name | Description |
---|---|
TSource | Source sequence element type. |
TKey | Key type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
DistinctUntilChanged<TSource, TKey>(IAsyncEnumerable<TSource>, Func<TSource, TKey>, IEqualityComparer<TKey>?)
Returns consecutive distinct elements based on a key value by using the specified equality comparer to compare key values.
Declaration
public static IAsyncEnumerable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | Source sequence. |
Func<TSource, TKey> | keySelector | Key selector. |
IEqualityComparer<TKey> | comparer | Comparer used to compare key values. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TSource> | Sequence without adjacent non-distinct elements. |
Type Parameters
Name | Description |
---|---|
TSource | Source sequence element type. |
TKey | Key type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
DistinctUntilChanged<TSource, TKey>(IAsyncEnumerable<TSource>, Func<TSource, ValueTask<TKey>>, IEqualityComparer<TKey>?)
Returns consecutive distinct elements based on a key value by using the specified equality comparer to compare key values.
Declaration
public static IAsyncEnumerable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TKey>> keySelector, IEqualityComparer<TKey>? comparer)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | Source sequence. |
Func<TSource, ValueTask<TKey>> | keySelector | Key selector. |
IEqualityComparer<TKey> | comparer | Comparer used to compare key values. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TSource> | Sequence without adjacent non-distinct elements. |
Type Parameters
Name | Description |
---|---|
TSource | Source sequence element type. |
TKey | Key type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|