Created
December 5, 2014 03:12
-
-
Save RxDave/262636653a19a9db23d2 to your computer and use it in GitHub Desktop.
Ix Publish Bug?
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
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 } |
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
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