浏览代码

Reordering overloads of Intersect.

Bart De Smet 8 年之前
父节点
当前提交
8a24dbf26a
共有 1 个文件被更改,包括 6 次插入7 次删除
  1. 6 7
      Ix.NET/Source/System.Interactive.Async/Intersect.cs

+ 6 - 7
Ix.NET/Source/System.Interactive.Async/Intersect.cs

@@ -10,27 +10,26 @@ namespace System.Linq
 {
     public static partial class AsyncEnumerable
     {
-        public static IAsyncEnumerable<TSource> Intersect<TSource>(this IAsyncEnumerable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
+        public static IAsyncEnumerable<TSource> Intersect<TSource>(this IAsyncEnumerable<TSource> first, IAsyncEnumerable<TSource> second)
         {
             if (first == null)
                 throw new ArgumentNullException(nameof(first));
             if (second == null)
                 throw new ArgumentNullException(nameof(second));
-            if (comparer == null)
-                throw new ArgumentNullException(nameof(comparer));
 
-            return new IntersectAsyncIterator<TSource>(first, second, comparer);
+            return first.Intersect(second, EqualityComparer<TSource>.Default);
         }
 
-
-        public static IAsyncEnumerable<TSource> Intersect<TSource>(this IAsyncEnumerable<TSource> first, IAsyncEnumerable<TSource> second)
+        public static IAsyncEnumerable<TSource> Intersect<TSource>(this IAsyncEnumerable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
         {
             if (first == null)
                 throw new ArgumentNullException(nameof(first));
             if (second == null)
                 throw new ArgumentNullException(nameof(second));
+            if (comparer == null)
+                throw new ArgumentNullException(nameof(comparer));
 
-            return first.Intersect(second, EqualityComparer<TSource>.Default);
+            return new IntersectAsyncIterator<TSource>(first, second, comparer);
         }
 
         private sealed class IntersectAsyncIterator<TSource> : AsyncIterator<TSource>