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) { 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); }