示例#1
0
        static void Main(string[] args)
        {
            var subject = new Subject();

            new HexaObserver(subject);
            new OctalObserver(subject);
            new BinaryObserver(subject);

            Console.WriteLine("First state change: 15");
            subject.SetState(15);
            Console.WriteLine();
            Console.WriteLine("Second state change: 10");
            subject.SetState(10);

            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            Subject subject = new Subject();

            new Addition(subject);

            Console.WriteLine("Addition : 15");
            subject.SetState(15);
        }