Browse Source

Moving SubscribeAsync extension methods.

Bart De Smet 8 years ago
parent
commit
e11a5d6705

+ 26 - 0
AsyncRx.NET/System.Reactive.Async.Linq/System/AsyncObservableExtensions.cs

@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the Apache 2.0 License.
+// See the LICENSE file in the project root for more information. 
+
+using System.Reactive.Linq;
+using System.Threading.Tasks;
+
+namespace System
+{
+    public static class AsyncObservableExtensions
+    {
+        public static Task<IAsyncDisposable> SubscribeAsync<T>(this IAsyncObservable<T> source, Func<T, Task> onNextAsync, Func<Exception, Task> onErrorAsync, Func<Task> onCompletedAsync)
+        {
+            if (source == null)
+                throw new ArgumentNullException(nameof(source));
+            if (onNextAsync == null)
+                throw new ArgumentNullException(nameof(onNextAsync));
+            if (onErrorAsync == null)
+                throw new ArgumentNullException(nameof(onErrorAsync));
+            if (onCompletedAsync == null)
+                throw new ArgumentNullException(nameof(onCompletedAsync));
+
+            return source.SubscribeAsync(AsyncObserver.Create(onNextAsync, onErrorAsync, onCompletedAsync));
+        }
+    }
+}

+ 0 - 14
AsyncRx.NET/System.Reactive.Async.Linq/System/Reactive/Linq/AsyncObservable.cs

@@ -17,20 +17,6 @@ namespace System.Reactive.Linq
             return new AnonymousAsyncObservable<T>(subscribeAsync);
         }
 
-        public static Task<IAsyncDisposable> SubscribeAsync<T>(this IAsyncObservable<T> source, Func<T, Task> onNextAsync, Func<Exception, Task> onErrorAsync, Func<Task> onCompletedAsync)
-        {
-            if (source == null)
-                throw new ArgumentNullException(nameof(source));
-            if (onNextAsync == null)
-                throw new ArgumentNullException(nameof(onNextAsync));
-            if (onErrorAsync == null)
-                throw new ArgumentNullException(nameof(onErrorAsync));
-            if (onCompletedAsync == null)
-                throw new ArgumentNullException(nameof(onCompletedAsync));
-
-            return source.SubscribeAsync(AsyncObserver.Create(onNextAsync, onErrorAsync, onCompletedAsync));
-        }
-
         public static Task<IAsyncDisposable> SubscribeSafeAsync<T>(this IAsyncObservable<T> source, IAsyncObserver<T> observer)
         {
             if (source == null)