Exemple #1
0
        public static void UseMulticastDelegate()
        {
            Console.WriteLine("Start UseMulticastDelegate");
            NoteFunction multicastDelegate = null;

            multicastDelegate += WriteMethod;
            multicastDelegate += ReadMethod;
            multicastDelegate -= WriteMethod;
            WriteNoteInformation(multicastDelegate);
            string returnString = multicastDelegate();

            Console.WriteLine(returnString);
            Console.WriteLine("End UseMulticastDelegate");
        }
Exemple #2
0
        public static void UseDelegate()
        {
            Console.WriteLine("Start UseDelegate");
            NoteFunction write, read;

            write = new NoteFunction(WriteMethod);
            write = WriteMethod;
            read  = ReadMethod;
            write();
            read();
            WriteNoteInformation(write);
            WriteNoteInformation(new NoteFunction(CalculateMethod));
            Console.WriteLine("End UseDelegate");
        }
Exemple #3
0
        private static string WriteNoteInformation(NoteFunction writtenNote)
        {
            string returnString = "";

            Console.WriteLine();
            Console.WriteLine("-------------------------------- Note Information ---------------------------------");
            if (writtenNote != null)
            {
                returnString = writtenNote();
            }
            Console.WriteLine("-------------------------------- End Note Information ---------------------------------");
            Console.WriteLine();

            return(returnString);
        }