Pet*_*ete 19
难道System.Collections.Generic.Dictionary<string, System.Delegate>还不够?
嗯,这是一个简单的例子:
class Program
{
public delegate double MethodDelegate( double a );
static void Main()
{
var delList = new List<MethodDelegate> {Foo, FooBar};
Console.WriteLine(delList[0](12.34));
Console.WriteLine(delList[1](16.34));
Console.ReadLine();
}
private static double Foo(double a)
{
return Math.Round(a);
}
private static double FooBar(double a)
{
return Math.Round(a);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
24801 次 |
| 最近记录: |