Bladeren bron

Reordering Distinct overloads.

Bart De Smet 8 jaren geleden
bovenliggende
commit
e857487e31
1 gewijzigde bestanden met toevoegingen van 14 en 14 verwijderingen
  1. 14 14
      Ix.NET/Source/System.Interactive.Async/Distinct.cs

+ 14 - 14
Ix.NET/Source/System.Interactive.Async/Distinct.cs

@@ -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)