如何将委托类型作为函数参数???
class Test
{
delegate void SimpleDelegate();
static void F()
{
System.Console.WriteLine("Test.F");
}
public void kk(int count, SimpleDelegate t)
{
for (int i = 0; i < count; i++)
t();
}
static void Main()
{
SimpleDelegate ff = new SimpleDelegate(F);
Test test2 = new Test();
test2.kk(3,ff);
}
}
运行会出错:
Inconsistent accessibility: parameter type 'ConsoleApplication1.Test.SimpleDelegate' is less accessible than method 'ConsoleApplication1.Test.kk(int, ConsoleApplication1.Test.SimpleDelegate)'
我想知道如何将委托类型作为函数参数???