I think you're misunderstanding what partial classes are for.
Partial classes don't allow you to implement "part" of a class or interface. Partial classes are just a method to allow parts of a class to be defined in different places. When the compiler builds your project, it finds all of the partial definitions for a class and mashes them together into the complete definition.
For example, this code:
partial class MyClass: BaseClass
{
}
sealed partial class MyClass: IFirstInterface
{
public void FirstMethod(){ }
}
public partial class MyClass: ISecondInterface
{
public void SecondMethod(){ }
}
really translates to this:
public sealed class MyClass : BaseClass, IFirstInterface, ISecondInterface
{
public void FirstMethod(){ }
public void SecondMethod(){ }
}
All of the members, modifiers, implemented interfaces, and inherited classes get applied to the class when it is built.
The typical usage for this is when part of a class is dynamically generated (e.g. by a tool or designer) and part of the class is manually generated. The class can be declared partial and split between two files - one that you don't touch (because the tool could regenerate it at any time) and one that the tool doesn't touch, where you put all of your code.
In your case, declaring multiple partial classes serves no purpose. Since one of your partial definitions includes MyService : IKCCWebService
, the MyService
class is required to define all of the members defined by IKCCWebService
.
If you don't want to implement the logic for all the interfaces in one shot, you don't have to. Just define the required interface methods with a single line: throw new NotImplementedExeption();
The compiler doesn't care what the methods do, so long as the methods are defined.