编译器错误 CS0766
更新:2007 年 11 月
错误消息
分部方法必须具有 void 返回类型。
分部方法不能返回值。其返回类型必须为 void。
更正此错误
- 为分部方法指定 void 返回类型,或将该方法转换为常规(非分部)方法。
示例
下面的示例生成 CS0766:
// cs0766.cs
using System;
public partial class C
{
partial int Part(); // CS0766
// Typically the implementing declaration
// is contained in a separate file.
partial int Part() //CS0766
{
}
public static int Main()
{
return 1;
}
}