Compiler Error CS0260

类型“type”的声明上缺少分部修饰符;存在此类型的其他分部声明

此错误指示您声明具有相同名称的多个类。此外,至少一个,但并非全部声明包含一个 partial 修饰符。如果您想在若干部分中定义一个类,通过使用关键字 partial,必须声明每个部分。

如果您声明一个新类碰巧与同一命名空间中的其他位置声明的分部类具有相同的名称,则也会发生此错误。

下面的示例生成 CS0260:

// CS0260.cs
// You must mark both parts of the definition of class C 
// by using the partial keyword.

// The following line causes CS0260\. To resolve the error, add
// the 'partial' keyword to the declaration.
class C  
{
}

partial class C
{
}

请参阅

分部类和方法(C# 编程指南)