Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/rx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Rx/NET/Samples/HOL/CS/Excercise2/Step10/Program.cs')
-rw-r--r--Rx/NET/Samples/HOL/CS/Excercise2/Step10/Program.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/Rx/NET/Samples/HOL/CS/Excercise2/Step10/Program.cs b/Rx/NET/Samples/HOL/CS/Excercise2/Step10/Program.cs
new file mode 100644
index 0000000..a099a9a
--- /dev/null
+++ b/Rx/NET/Samples/HOL/CS/Excercise2/Step10/Program.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Linq;
+using System.Reactive.Linq;
+
+namespace Excercise2
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ IObservable<int> source = Observable.Generate(
+ 0, i => i < 5,
+ i => i + 1,
+ i => i * i,
+ i => TimeSpan.FromSeconds(i)
+ );
+
+ using (source.Subscribe(
+ x => Console.WriteLine("OnNext: {0}", x),
+ ex => Console.WriteLine("OnError: {0}", ex.Message),
+ () => Console.WriteLine("OnCompleted")
+ ))
+ {
+ Console.WriteLine("Press ENTER to unsubscribe...");
+ Console.ReadLine();
+ }
+ }
+ }
+}