Ejemplo n.º 1
0
        private static void RunWithRx()
        {
            var person = new RxPerson {
                Name = "Erik"
            };

            // Subscribe to listen to changes
            var subscription = person.PropertyChanged
                               .Where(x => x.NewValue.Length > 4)
                               .Subscribe(e =>
            {
                Console.WriteLine(e.NewValue);
            });

            // Change the name
            person.Name = "Bart";
            person.Name = "Matthew";
            person.Name = "Matthew";
            person.Name = "Steve";

            subscription.Dispose();

            person.Name = "Bill";
        }
Ejemplo n.º 2
0
        private static void RunWithRx()
        {
            var person = new RxPerson { Name = "Erik" };

            // Subscribe to listen to changes
            var subscription = person.PropertyChanged
                .Where(x => x.NewValue.Length > 4)
                .Subscribe(e =>
            {
                Console.WriteLine(e.NewValue);
            });

            // Change the name
            person.Name = "Bart";
            person.Name = "Matthew";
            person.Name = "Matthew";
            person.Name = "Steve";

            subscription.Dispose();

            person.Name = "Bill";
        }