private static void ConcatObservable() { using (Xs.Concat(Ys).Timestamp().Subscribe( z => System.Console.WriteLine($"{z.Value}: {z.Timestamp}"), () => System.Console.WriteLine("Completed. PRESS => ME"))) { System.Console.ReadKey(); } }
internal static void Run() { var ev = new ManualResetEvent(false); Console.WriteLine("Merge X and Y"); using (Xs.Merge(Ys).Subscribe( z => Console.Write("{0} ", z), () => ev.Set())) { ev.WaitOne(); } Console.WriteLine(); ev.Reset(); Console.WriteLine("Zip X, Y -> X + Y"); using (Xs.Zip(Ys, (x, y) => x + y) .Subscribe( z => Console.Write("{0} ", z), () => ev.Set())) { ev.WaitOne(); } Console.WriteLine(); ev.Reset(); Console.WriteLine("Combine X, Y -> X + Y"); using (Xs.CombineLatest(Ys, (x, y) => x + y) .Subscribe( z => Console.Write("{0} ", z), () => ev.Set())) { ev.WaitOne(); } Console.WriteLine(); ev.Reset(); Console.WriteLine("Concat X and Y"); using (Xs.Concat(Ys) .Subscribe( z => Console.Write("{0} ", z), () => ev.Set())) { ev.WaitOne(); } Console.WriteLine(); ev.Reset(); }