using System;
using System.Collections.Generic;
using System.Text;
namespace DelegateApp
{
class DelegateClass
{
delegate void Del(string Name);//声明一个代理
public void F1(string Name)
{
Console.WriteLine("CNN "+Name);
}
public void F2(string Name)
{
Console.WriteLine("Carefare " + Name);
}
public void F3(string Name)
{
Console.WriteLine("Hondar " + Name);
}
public void Print()
{
Del f = (new Del(F1)) + (new Del(F2)) + (new Del(F1));//代理注册
f("La");//代理调用
}
}
class Program
{
static void Main(string[] args)
{ DelegateClass d = new DelegateClass();
d.Print();
}
}
}