|
|
@@ -11,16 +11,22 @@ namespace System.Linq
|
|
|
{
|
|
|
public static partial class AsyncEnumerable
|
|
|
{
|
|
|
- public static IAsyncEnumerable<TSource> Distinct<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
|
|
|
+ public static IAsyncEnumerable<TSource> Distinct<TSource>(this IAsyncEnumerable<TSource> source)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+
|
|
|
+ return source.Distinct(EqualityComparer<TSource>.Default);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static IAsyncEnumerable<TSource> Distinct<TSource>(this IAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer)
|
|
|
{
|
|
|
if (source == null)
|
|
|
throw new ArgumentNullException(nameof(source));
|
|
|
- if (keySelector == null)
|
|
|
- throw new ArgumentNullException(nameof(keySelector));
|
|
|
if (comparer == null)
|
|
|
throw new ArgumentNullException(nameof(comparer));
|
|
|
|
|
|
- return new DistinctAsyncIterator<TSource, TKey>(source, keySelector, comparer);
|
|
|
+ return new DistinctAsyncIterator<TSource>(source, comparer);
|
|
|
}
|
|
|
|
|
|
public static IAsyncEnumerable<TSource> Distinct<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
|
|
@@ -33,22 +39,16 @@ namespace System.Linq
|
|
|
return source.Distinct(keySelector, EqualityComparer<TKey>.Default);
|
|
|
}
|
|
|
|
|
|
- public static IAsyncEnumerable<TSource> Distinct<TSource>(this IAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer)
|
|
|
+ public static IAsyncEnumerable<TSource> Distinct<TSource, TKey>(this IAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
|
|
|
{
|
|
|
if (source == null)
|
|
|
throw new ArgumentNullException(nameof(source));
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException(nameof(keySelector));
|
|
|
if (comparer == null)
|
|
|
throw new ArgumentNullException(nameof(comparer));
|
|
|
|
|
|
- return new DistinctAsyncIterator<TSource>(source, comparer);
|
|
|
- }
|
|
|
-
|
|
|
- public static IAsyncEnumerable<TSource> Distinct<TSource>(this IAsyncEnumerable<TSource> source)
|
|
|
- {
|
|
|
- if (source == null)
|
|
|
- throw new ArgumentNullException(nameof(source));
|
|
|
-
|
|
|
- return source.Distinct(EqualityComparer<TSource>.Default);
|
|
|
+ return new DistinctAsyncIterator<TSource, TKey>(source, keySelector, comparer);
|
|
|
}
|
|
|
|
|
|
public static IAsyncEnumerable<TSource> DistinctUntilChanged<TSource>(this IAsyncEnumerable<TSource> source)
|