Method HasDuplicates
HasDuplicates<T>(IAsyncEnumerable<T>)
Checks if sequence contains duplicates
Declaration
public static ValueTask<bool> HasDuplicates<T>(this IAsyncEnumerable<T> source)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<T> | source | The sequence to check. |
Returns
| Type | Description |
|---|---|
| ValueTask<bool> | true if any element of the sequence |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements in the source sequence |
HasDuplicates<T>(IAsyncEnumerable<T>, IEqualityComparer<T>?)
Checks if sequence contains duplicates, using the specified element equality comparer
Declaration
public static ValueTask<bool> HasDuplicates<T>(this IAsyncEnumerable<T> source, IEqualityComparer<T>? comparer)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<T> | source | The sequence to check. |
| IEqualityComparer<T> | comparer | The equality comparer to use to determine whether or not keys are equal.
If null, the default equality comparer for |
Returns
| Type | Description |
|---|---|
| ValueTask<bool> | true if any element of the sequence |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements in the source sequence |
HasDuplicates<TSource, TKey>(IAsyncEnumerable<TSource>, Func<TSource, TKey>)
Checks if sequence contains duplicates, using the specified element equality comparer
Declaration
public static ValueTask<bool> HasDuplicates<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | The sequence to check. |
| Func<TSource, TKey> | keySelector | Projection for determining "distinctness" |
Returns
| Type | Description |
|---|---|
| ValueTask<bool> | true if any element of the sequence |
Type Parameters
| Name | Description |
|---|---|
| TSource | Type of the source sequence |
| TKey | Type of the projected element |
HasDuplicates<TSource, TKey>(IAsyncEnumerable<TSource>, Func<TSource, TKey>, IEqualityComparer<TKey>?)
Checks if sequence contains duplicates, using the specified element equality comparer
Declaration
public static ValueTask<bool> HasDuplicates<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | The sequence to check. |
| Func<TSource, TKey> | keySelector | Projection for determining "distinctness" |
| IEqualityComparer<TKey> | comparer | The equality comparer to use to determine whether or not keys are equal.
If null, the default equality comparer for |
Returns
| Type | Description |
|---|---|
| ValueTask<bool> | true if any element of the sequence |
Type Parameters
| Name | Description |
|---|---|
| TSource | Type of the source sequence |
| TKey | Type of the projected element |