using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Delegate
{
public delegate void Myfunction();
class Program
{
static void Main(string[] args)
{
Myfunction mf = (Myfunction)Myfunction.Combine(
new Myfunction[]{MethodA,MethodA,MethodB,MethodC}
);
mf();
foreach (Myfunction item in mf.GetInvocationList())
{
Console.WriteLine(item.Method.Name + " in list");
}
Console.ReadLine();
}
public static void MethodA() {
Console.WriteLine("A doing");
}
public static void MethodB()
{
Console.WriteLine("B doing");
}
public static void MethodC()
{
Console.WriteLine("C doing");
}
}
}
转载于:https://www.cnblogs.com/MarchThree/p/3720453.html