public static void Main(string[] args) { DelegFoo del1 = foo1; DelegFoo del2 = foo2; string testString = "test"; Console.WriteLine("TestDelegat1: " + TestDelegat(del1, testString)); Console.WriteLine("TestDelegat2: " + TestDelegat(del2, testString)); Console.ReadKey(true); }
//delegate - передаеться по ссылке static int TestDelegat(DelegFoo method, string testString) { return(method(testString)); }