using System;
public class Machine
{
string name;
public Machine(string name)
{
this.name = name;
}
public void Process(string message)
{
Console.WriteLine("{0}: {1}", name, message);
}
}
class Test
{
delegate void ProcessHandler(string message);
static public void Process(string message)
{
Console.WriteLine("Test.Process(\"{0}\")", message);
}
public static void Main()
{
Machine computer = new Machine("Computer");
ProcessHandler ph = new ProcessHandler(computer.Process);
ph = (ProcessHandler) Delegate.Combine(ph, new ProcessHandler(Process));
ph("compile");
}
}
|