浏览代码

Sorting ElementAt overloads.

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

+ 10 - 10
Ix.NET/Source/System.Interactive.Async/ElementAt.cs

@@ -10,6 +10,14 @@ namespace System.Linq
 {
     public static partial class AsyncEnumerable
     {
+        public static Task<TSource> ElementAt<TSource>(this IAsyncEnumerable<TSource> source, int index)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return ElementAt(source, index, CancellationToken.None);
+        }
+
         public static Task<TSource> ElementAt<TSource>(this IAsyncEnumerable<TSource> source, int index, CancellationToken cancellationToken)
         {
             if (source == null)
@@ -20,12 +28,12 @@ namespace System.Linq
             return ElementAt_(source, index, cancellationToken);
         }
 
-        public static Task<TSource> ElementAt<TSource>(this IAsyncEnumerable<TSource> source, int index)
+        public static Task<TSource> ElementAtOrDefault<TSource>(this IAsyncEnumerable<TSource> source, int index)
         {
             if (source == null)
                 throw new ArgumentNullException(nameof(source));
 
-            return ElementAt(source, index, CancellationToken.None);
+            return ElementAtOrDefault(source, index, CancellationToken.None);
         }
 
         public static Task<TSource> ElementAtOrDefault<TSource>(this IAsyncEnumerable<TSource> source, int index, CancellationToken cancellationToken)
@@ -38,14 +46,6 @@ namespace System.Linq
             return ElementAtOrDefault_(source, index, cancellationToken);
         }
 
-        public static Task<TSource> ElementAtOrDefault<TSource>(this IAsyncEnumerable<TSource> source, int index)
-        {
-            if (source == null)
-                throw new ArgumentNullException(nameof(source));
-
-            return ElementAtOrDefault(source, index, CancellationToken.None);
-        }
-
         private static async Task<TSource> ElementAt_<TSource>(IAsyncEnumerable<TSource> source, int index, CancellationToken cancellationToken)
         {
             if (source is IList<TSource> list)