Skip to content

Instantly share code, notes, and snippets.

@LeeCampbell
Created May 20, 2014 14:15
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 LeeCampbell/ae96639175b478459b69 to your computer and use it in GitHub Desktop.
Save LeeCampbell/ae96639175b478459b69 to your computer and use it in GitHub Desktop.
Rx delta without Zip/DualSubscription
//From James World - http://social.msdn.microsoft.com/Forums/en-US/dfa87af8-b7dd-4fb5-abe2-99348d3e27e1/compare-two-object-graphs-and-get-differences?forum=rx
public static IObservable<Tuple<TSource, TSource>> PairWithPrevious<TSource>(this IObservable<TSource> source)
{
return source.Scan(
Tuple.Create(default(TSource), default(TSource)),
(acc, current) => Tuple.Create(acc.Item2, current));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment