1
0
Эх сурвалжийг харах

Reorder Repeat overloads.

Bart De Smet 8 жил өмнө
parent
commit
f0d897e6c2

+ 10 - 10
Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Repeat.cs

@@ -10,6 +10,11 @@ namespace System.Linq
 {
     public static partial class AsyncEnumerable
     {
+        public static IAsyncEnumerable<TResult> Repeat<TResult>(TResult element)
+        {
+            return new RepeatElementAsyncIterator<TResult>(element);
+        }
+
         public static IAsyncEnumerable<TResult> Repeat<TResult>(TResult element, int count)
         {
             if (count < 0)
@@ -18,9 +23,12 @@ namespace System.Linq
             return Enumerable.Repeat(element, count).ToAsyncEnumerable();
         }
 
-        public static IAsyncEnumerable<TResult> Repeat<TResult>(TResult element)
+        public static IAsyncEnumerable<TSource> Repeat<TSource>(this IAsyncEnumerable<TSource> source)
         {
-            return new RepeatElementAsyncIterator<TResult>(element);
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+
+            return new RepeatSequenceAsyncIterator<TSource>(source, -1);
         }
 
         public static IAsyncEnumerable<TSource> Repeat<TSource>(this IAsyncEnumerable<TSource> source, int count)
@@ -33,14 +41,6 @@ namespace System.Linq
             return new RepeatSequenceAsyncIterator<TSource>(source, count);
         }
 
-        public static IAsyncEnumerable<TSource> Repeat<TSource>(this IAsyncEnumerable<TSource> source)
-        {
-            if (source == null)
-                throw new ArgumentNullException(nameof(source));
-
-            return new RepeatSequenceAsyncIterator<TSource>(source, -1);
-        }
-
         private sealed class RepeatElementAsyncIterator<TResult> : AsyncIterator<TResult>
         {
             private readonly TResult element;