Quantcast
Channel: User Sinatr - Stack Overflow
Viewing all articles
Browse latest Browse all 367

Answer by Sinatr for How to queue WhenAnyValue subscriber calls containing asynchronous code?

$
0
0

Using this answer I've made my own SybscribeAsync extension method with parameter:

public static IDisposable SubscribeAsync<T>(this IObservable<T> source, Func<T, Task> func) =>            source.Select(o => Observable.FromAsync(_ => func(o)))                .Concat()                .Subscribe();

The method SubscribeAsync should be used instead of Subscribe(async o => ...), unless async void is not a problem (it could be).

P.S.: naming method SubscribeSynchronous like ReactiveMarbles does is the option.


Viewing all articles
Browse latest Browse all 367

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>