CS1061号错误是什么

原文地址:https://support.unity3d.com/hc/en-us/articles/206193836-What-is-CS1061-

症状

当尝试进入Play模式时,我得到了如下的错误:

error CS1061: Type `__’ does not contain a definition for `__’ and no extension method `__’ of type `__’ could be found (are you missing a using directive or an assembly reference?)

原因

当你尝试调用一个不存的方法或者访问一个不存的成员时,就会引发CS1061号错误。

下面的例子演示了尝试在Class1类型的对象上调用SayGoodbye方法。正如我们所见的那样类型Class1并没含有SayGoodbye的定义。

CS1061例子

本例子的错误信息如下:

error CS1061: Type `Class1’ does not contain a definition for `SayGoodbye’ and no extension method `SayGoodbye’ of type `Class1’ could be found (are you missing a using directive or an assembly reference?)

解决方案

你需要确保方法和类成员存在,并且从正确的位置访问它们,才能解决CS1061错误。

解决CS1061

更多信息

https://msdn.microsoft.com/en-us/library/bb383961.aspx

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值