Beispiel #1
0
 public static void Entry()
 {
     DelegateClass.runDelegateClass();
     AnotherDelegateClass.runAnotherDelegateClass();
     AnonymousClass.runAnonymousClass();
     SimpleDelegate.SimpleDelegateEntry();
     DelegateBubbleSorterTester.DelegateBubbleSorterTesterEntry();
     LambadaDelegate.LambadaDelegateEntry();
     delstring();
 }
Beispiel #2
0
        //-----------------------------------------------------------------------------------------------------
        private static void delstring()
        {
            string           s      = "This is Test For Delegate Function";
            mystringdelegate delobj = delegatestring.ReverseString;

            Console.WriteLine("Invoking First delegate :" + Environment.NewLine + "delobj = delegatestring.ReverseString;");

            Console.WriteLine("Normal String :{0}", s);
            delegatestring.ReverseString(s);
            Console.WriteLine("Reversed String :{0}", delobj(s));
            Console.WriteLine();
            delobj = delegatestring.RemoveSpace;
            Console.WriteLine("Invoking Second delegate :" + Environment.NewLine + "delobj = delegatestring.RemoveSpace;");

            Console.WriteLine("Normal String :{0}", s);
            delegatestring.ReverseString(s);
            Console.WriteLine("Modified String :{0}", delobj(s));
            Console.WriteLine();
            delobj = delegatestring.ReplaceSpace;
            Console.WriteLine("Invoking Third delegate :" + Environment.NewLine + "delobj = delegatestring.ReplaceSpace;");

            Console.WriteLine("Normal String :{0}", s);
            delegatestring.ReverseString(s);
            Console.WriteLine("Modified String :{0}", delobj(s));
            Console.WriteLine();

            Console.WriteLine("calling DelegateClass.runDelegateClass();");
            DelegateClass.runDelegateClass();
            Console.WriteLine();
            Console.WriteLine("calling AnotherDelegateClass.runAnotherDelegateClass();");

            AnotherDelegateClass.runAnotherDelegateClass();
            Console.WriteLine();
            Console.WriteLine("calling AnonymousClass.runAnonymousClass();");

            AnonymousClass.runAnonymousClass();
            Console.WriteLine();
        }