Exemple #1
0
        static void Main(string[] args)
        {
            // 델리게이트 인스턴스 생성
            PrintStr ps1 = new PrintStr(PrintString.WriteToScreen);
            PrintStr ps2 = PrintString.WriteToFile;

            // 델리게이트를 매개변수로 넘김
            PrintString.sendString(ps1);
            PrintString.sendString(ps2);
        }
        static void Main(string[] args)
        {
            PrintStrDelegate ps1 = new PrintStrDelegate(WriteToScreen);

            PrintString.Print("Hello World", ps1);

            PrintStrDelegate ps2 = WriteToFile;

            PrintString.Print("Hello Delegate!!!", ps2);
        }
        static void Main(string[] args)
        {
            PrintStr ps1 = new PrintStr(WriteToScreen);

            PrintString.sendString("Hello World", ps1);

            PrintStr ps2 = new PrintStr(WriteToScreen);

            PrintString.sendString("Hello Delegate!!!", ps2);
        }
        public static void Main(string[] args)
        {
            PrintStr ps1 = new PrintStr(WriteToScreen);

            PrintString.sendString("Hello World", ps1);


            PrintStr ps2 = new PrintStr(WriteToFile);

            PrintString.sendString("Hello World", ps2);
        }