mirror of
https://github.com/evopro-ag/Sharp7Reactive.git
synced 2025-12-16 11:42:52 +00:00
imported Sharp7.Rx
This commit is contained in:
24
Sharp7.Rx/Extensions/ObservableExtensions.cs
Normal file
24
Sharp7.Rx/Extensions/ObservableExtensions.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user