gpt4 book ai didi

c# - 使用委托(delegate) : Invalid token 'void' in class, 结构或接口(interface)成员声明时出错

转载 作者:行者123 更新时间:2023-11-30 22:19:49 25 4
gpt4 key购买 nike

我在声明委托(delegate)时遇到此错误:“类、结构或接口(interface)成员声明中的无效标记‘void’”

enter image description here

有人可以提出此错误的原因吗?

最佳答案

使用delegate代替Delegate

 public delegate void ShowDel(string msg);

The Delegate class is the base class for delegate types. However, only the system and compilers can derive explicitly from the Delegate class or from the MulticastDelegate class. It is also not permissible to derive a new type from a delegate type. The Delegate class is not considered a delegate type; it is a class used to derive delegate types. Most languages implement a delegate keyword, and compilers for those languages are able to derive from the MulticastDelegate class; therefore, users should use the delegate keyword provided by the language. MSDN

关于c# - 使用委托(delegate) : Invalid token 'void' in class, 结构或接口(interface)成员声明时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15353428/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com