Skip to content

Instantly share code, notes, and snippets.

@RxDave
Created December 5, 2014 03:12
Show Gist options
  • Save RxDave/262636653a19a9db23d2 to your computer and use it in GitHub Desktop.
Save RxDave/262636653a19a9db23d2 to your computer and use it in GitHub Desktop.
Ix Publish Bug?
Ix
{ left = 0, right = 2 }
{ left = 1, right = 3 }
{ left = 2, right = 4 }
Rx
{ left = 0, right = 1 }
{ left = 1, right = 2 }
{ left = 2, right = 3 }
{ left = 3, right = 4 }
using System;
using System.Linq;
using System.Reactive.Linq;
namespace Rxx.Labs.Bugs
{
static class IxPublishBugLab
{
static void Main()
{
Console.WriteLine("Ix");
var xs = Enumerable.Range(0, 5);
var ys = xs.Publish(p => p.Zip(p.Skip(1), (left, right) => new { left, right }));
ys.ForEach(Console.WriteLine);
Console.WriteLine();
Console.WriteLine("Rx");
var js = Observable.Range(0, 5);
var ks = js.Publish(p => p.Zip(p.Skip(1), (left, right) => new { left, right }));
using (ks.Subscribe(Console.WriteLine))
{
Console.ReadKey();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment