有关委托 C#语法问题
网上看到类似这样的代码
public delegate bool Unit();
void TestUnit(Unit u)
{
if (!u())
{
// TODO:
}
}
刚学C#,有些语法上不了解。
请问调用端代码什么写,才能正确调用TestUnit
c#语法 --------------------编程问答--------------------
class Program
{
delegate bool Unit();
static bool foo()
{
...
}
static void TestUnit(Unit u)
{
if (!u())
{
// TODO:
}
}
static void Main(string[] Args)
{
TestUnit(new Unit(foo));
}
}
补充:.NET技术 , C#