static void Main(string[] args) { // create a new list ListWithChangedEvent list = new ListWithChangedEvent(); // create a class that litens for when the list is changed EventListener listener = new EventListener(list); list.Add(1); list.Add(2); list.Add(3); list.Add(4); list.Add(5); list.Add(15); list.Add(30); Console.WriteLine(); list.PrintList(); list.FizzBuzz(); list.Clear(); listener.Detatch(); Console.ReadKey(); }
static void Main(string[] args) { int[] num = { 1, 2, 3, 4, 5, 6, 15, 30 }; // Create a new list ListWithChangedEvent list = new ListWithChangedEvent(); // Create a class that listens for when the list is changed EventListener listener = new EventListener(list); for (int i = 0; i < num.Length; i++) { list.Add(num[i]); } Console.WriteLine(); list.PrintList(); list.FizzBuzz(); list.PrintList(); list.Clear(); listener.Detatch(); Console.ReadKey(); }