Beispiel #1
0
        public void ArrayTest()
        {
            // Create a new list.
            ListWithChangedEvent list = new ListWithChangedEvent();

            list.Changed += new ChangedEventHandler(ListChanged);

            // Add and remove items from the list.
            list.Add("item 1");
            list.Clear();
        }
Beispiel #2
0
        // Test the ListWithChangedEvent class.
        public static void Main()
        {
            // Create a new list.
            ListWithChangedEvent list = new ListWithChangedEvent();

            // Create a class that listens to the list's change event.
            EventListener listener = new EventListener(list);

            // Add and remove items from the list.
            list.Add("item 1");
            list.Clear();
            listener.Detach();
        }