Beispiel #1
0
        static void Main(string[] args)
        {
            // The delegate is a refrence to a method, it describe what kind of method can hold
            // 1. Declare a delegate
            // 2. Create a method to use the delegate
            // 3. Create one or more methods that matches the delegate's return value and parameters
            // so I create playAudio, and playVideo
            // 4. Instantiate the delegate
            // 5. Invoke the method through the delegate

            // step 4
            IsValid testMedia = PlayAudio;

            Console.WriteLine(TestResults(testMedia));

            testMedia = PlayVideo;
            Console.WriteLine(TestResults(testMedia));

            IsValid2 test = TestVoid;

            TestCallTheVoidDelegate(test);

            Console.Read();
        }
Beispiel #2
0
 public static void TestCallTheVoidDelegate(IsValid2 isValid2Delegate)
 {
     Console.WriteLine(isValid2Delegate);
 }