Created
April 22, 2016 13:40
-
-
Save yuka1984/9fb1afb3dd75007e8bde498eead908ef to your computer and use it in GitHub Desktop.
RxSyncTimeout.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IObservable<TResult> SyncTimeout<TSource, TResult>(this IObservable<TSource> first, | |
IObservable<TSource> second, TimeSpan dueTime, Func<TSource, TSource, TResult> selectorFunc) | |
{ | |
return | |
first | |
.Zip(second.Timeout(dueTime).Take(1), (f, s) => new {First = f, Second = s}) | |
.Repeat() | |
.Select(x => selectorFunc(x.First, x.Second)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment