Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mattbarrett
Created May 5, 2015 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattbarrett/5e795a596e500f82aff3 to your computer and use it in GitHub Desktop.
Save mattbarrett/5e795a596e500f82aff3 to your computer and use it in GitHub Desktop.
withLatestFrom operator
void Main()
{
var slow = Observable.Interval(TimeSpan.FromSeconds(1));
var fast = Observable.Interval(TimeSpan.FromMilliseconds(250));
Observable.CombineLatest(
slow,
fast,
Tuple.Create)
.DistinctUntilChanged(tp => tp.Item1)
.Dump();
// Observable.CombineLatest(
// slow.Select((t, i) => new { T = t, Idx = i }),
// fast.Select((t, i) => new { T = t, Idx = i}),
// (s, f) => new { slow = s, fast = f})
// .DistinctUntilChanged(at => at.slow.Idx)
// .Dump();
}
@mattbarrett
Copy link
Author

As implemented to match the specification given by Ben at https://github.com/ReactiveX/RxJava/releases/tag/v1.0.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment