Esempio n. 1
0
        static void Main(string[] args)
        {
            // create a new list
            ListWithChangedEvent list = new ListWithChangedEvent();
            // creeat a class that listens for when the list is changed
            EventListener listener = new EventListener(list);


            list.Add("hello");
            list.Add("world");

            for (int i = 0; i < list.arraySize; i++)
            {
                Console.WriteLine(list[i]);
            }
            list.Clear();
            listener.Detatch();



            Console.ReadKey();
        }
Esempio n. 2
0
 public void Detatch()
 {
     List.Changed -= new ChangeEventHandler(OnListChanged);
     List          = null;
 }
Esempio n. 3
0
 public EventListener(ListWithChangedEvent list)
 {
     List          = list;
     List.Changed += new ChangeEventHandler(OnListChanged);
 }