コード例 #1
0
        public void Pred()
        {
            var d = DisposableBag.CreateBuilder();

            this.keylessS.Subscribe(x =>
            {
                Console.WriteLine("FilteredA:" + x.MyProperty);
            }, x => x.MyProperty == "foo" || x.MyProperty == "hoge")
            .AddTo(d);


            this.keylessS.Subscribe(x =>
            {
                Console.WriteLine("FilteredB:" + x.MyProperty);
            }, x => x.MyProperty == "foo" || x.MyProperty == "hage").AddTo(d);

            this.keylessP.Publish(new MyMessage {
                MyProperty = "nano"
            });
            this.keylessP.Publish(new MyMessage {
                MyProperty = "foo"
            });
            this.keylessP.Publish(new MyMessage {
                MyProperty = "hage"
            });
            this.keylessP.Publish(new MyMessage {
                MyProperty = "hoge"
            });

            this.intSubscriber.Subscribe(x => Console.WriteLine(x), x => x < 10).AddTo(d);
            this.intPublisher.Publish(999);
            this.intPublisher.Publish(5);

            d.Build().Dispose();
            d.Clear();
            Console.WriteLine("----");

            intSubscriber.Subscribe(x =>
            {
                Console.WriteLine("int one:" + x);
            }, new ChangedValueFilter <int>());

            intPublisher.Publish(100);
            intPublisher.Publish(200);
            intPublisher.Publish(200);
            intPublisher.Publish(299);
        }