Пример #1
0
        static void Main(string[] args)
        {
            var collection = new CollectionNumber();

            collection.Subscribe(new Listener());
            collection.Add(5);
            collection.Add(1);
            collection.Add(3);
            collection.Subscribe(new Listener());
            collection.Add(0);
            collection.Delete(1);

            foreach (var item in collection)
            {
                Console.WriteLine(item);
            }
            Console.ReadLine();
        }
Пример #2
0
 public Unsubscriber(CollectionNumber sensor, IObserver <CollectionNumber> listener)
 {
     _sensor   = sensor;
     _listener = listener;
 }