使用英语阅读

通过


编译器错误 CS0766

分部方法必须具有 void 返回类型。

分部方法无法返回值。 其返回类型必须为 void。

更正此错误

  1. 为分部方法提供 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;  
        }  
  
    }  

另请参阅