编译器错误 CS0262Compiler Error CS0262

“type”的分部声明包含冲突的可访问性修饰符Partial declarations of 'type' have conflicting accessibility modifiers

如果分部类型具有不一致的修饰符(例如公共、私有、受保护、内部或抽象修饰符),会出现此错误。This error occurs if a partial type has inconsistent modifiers such as public, private, protected, internal, or abstract. 这些修饰符必须在该类型的所有分部声明中保持一致。These modifiers must be consistent in all partial declarations for that type. 有关详细信息,请参阅分部类和方法For more information, see Partial Classes and Methods.

示例Example

下面的示例生成 CS0262:The following sample generates CS0262:

// CS0262.cs  
class A  
{  
    public partial class C  // CS0262  
    {  
    }  
    private partial class C  
    {  
    }  
}