Пример #1
0
        static void Main(string[] args)
        {
            var stockTicker = new ConcreteStockTicker();
            var ibmObserver = new IBMStockObserver("ROBER KANASZ");
            var allObserver = new AllStockObserver("IVOR LOTOCASH");

            stockTicker.Register(ibmObserver);
            stockTicker.Register(allObserver);

            foreach (var s in StockData.getNext())
                stockTicker.Stock = s;
        }
Пример #2
0
        static void Main(string[] args)
        {
            var stockTicker = new ConcreteStockTicker();
            var ibmObserver = new IBMStockObserver("ROBER KANASZ");
            var allObserver = new AllStockObserver("IVOR LOTOCASH");

            stockTicker.Register(ibmObserver);
            stockTicker.Register(allObserver);

            foreach (var s in StockData.getNext())
            {
                stockTicker.Stock = s;
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            var stockTicker  = new ConcreteStockTicker();
            var ibmObserver  = new IBMStockObserver("ROBER KANASZ");
            var ibmObserver2 = new IBMStockObserver("ROBER KANASZ");
            var allObserver  = new AllStockObserver("IVOR LOTOCASH");

            stockTicker.Register(ibmObserver);
            stockTicker.Register(ibmObserver2);
            stockTicker.Register(allObserver);

            foreach (var s in StockData.getNext())
            {
                stockTicker.Stock = s; // here, object changed is Stock -> change all att of obj
            }
            Console.ReadKey();
        }