Exemplo n.º 1
0
        static void Main()
        {
            SimpleDelegate sd = new SimpleDelegate();

            //this is the delegate instantiation
            Comparer cmp = new Comparer(Name.CompareFirstNames);

            Console.WriteLine("\nBefore Sort: \n");

            sd.PrintNames();

            //observe the delegate argument
            sd.Sort(cmp);

            Console.WriteLine("\nAfter Sort: \n");

            sd.PrintNames();

            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            SimpleDelegate sd = new SimpleDelegate();

            //this is the delegate instantiation
            Comparer cmp = new Comparer(SimpleDelegate.CompareFirstNames);

            Console.WriteLine("\nBefore Sort:\n");

            sd.PrintNames();

            Console.WriteLine("\nAfter Sort:\n");

            sd.Sort(cmp);

            sd.PrintNames();

            Console.ReadLine();

             //   Application.Run(new Eventdemo());
        }