コード例 #1
0
        static void Main(string[] args)
        {
            printString ps1 = new printString(WriteToScreen);
            printString ps2 = new printString(WriteToFile);
            sendString(ps1);
            sendString(ps2);

            Console.ReadKey();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: adolescent/csharp-delegate
        static void Main(string[] args)
        {
            printString ps1 = new printString(WriteToScreen);
            printString ps2 = new printString(WriteToFile);

            ps1("Hello World");
            ps2("Hello World");

            Console.ReadKey();
        }
コード例 #3
0
 // this method takes the delegate as parameter and uses it to
 // call the methods as required
 public static void sendString(printString ps)
 {
     ps("Hello World");
 }