我正在尝试让以下简单的委托示例正常工作。根据我从中取出的一本书,应该没问题,但我得到了Method name expected
error.
namespace TestConsoleApp
{
class Program
{
private delegate string D();
static void Main(string[] args)
{
int x = 1;
D code = new D(x.ToString());
}
}
}
有什么帮助吗?
去除 ():
D code = new D(x.ToString);
你想要specify方法,不是execute it.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)