Compiler Error CS0263

Switch View :
ScriptFree
Visual C# Reference: Errors and Warnings
Compiler Error CS0263

Partial declarations of 'type' must not specify different base classes

When defining a type in partial declarations, specify the same base types in each of the partial declarations. For more information, see Partial Classes and Methods (C# Programming Guide).

The following sample generates CS0263:


// CS0263.cs
// compile with: /target:library
class B1
{
}

class B2
{
}
partial class C : B1  // CS0263 – is the base class B1 or B2?
{
}

partial class C : B2
{
}
Community Content

Michael Thrill Hill
WPF: Changing base class from UserControl to Label
Please add examples that show exceptional cases in addition to the most basic use case.  I need to know why, when I create a custom UserControl in WPF and change the base class from UserControl to Label, I get this error.  I think it has to do with the XAML having references to the UserControl. The user control references that I talking about are created by default from the Visual Studio Wizard.