【发布时间】:2017-06-14 15:03:10
【问题描述】:
如何将函数用作另一个函数的参数并将其分配给委托
public class myClass
{
public delegate void myDelegate(double x, string s);
//declaration of delegate
public void func(double x, string s)
{
dosomethings...
}
// what is the declaration of the argument 'Function declaration'
public void myFunction('Function declaration' function)
{
myDelegate deFunc;
deFunc = function;
}
}
static void Main(string[] args)
{
myFunction(func);
}
}
【问题讨论】:
-
或
myFunction(myDelegate @delegate)。 -
@EdPlunkett dotnetfiddle.net/bNAElH
-
@Toshi Derp。谢谢。
标签: c#