imported Sharp7.Rx

This commit is contained in:
Thomas Stangl
2018-11-05 16:23:37 +01:00
parent aedfa4075f
commit d8d07c1679
18 changed files with 1169 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
using System;
using System.Reactive;
using System.Reactive.Linq;
using System.Threading.Tasks;
namespace Sharp7.Rx.Extensions
{
internal static class ObservableExtensions
{
public static IObservable<Unit> Select<TSource>(this IObservable<TSource> source, Func<TSource, Task> selector)
{
return source
.Select(x => Observable.FromAsync(async () => await selector(x)))
.Concat();
}
public static IObservable<TResult> Select<TSource, TResult>(this IObservable<TSource> source, Func<TSource, Task<TResult>> selector)
{
return source
.Select(x => Observable.FromAsync(async () => await selector(x)))
.Concat();
}
}
}