Code Snippet
public interface I1
{
void Method();
}
public interface I2
{
void Method();
}
public class Implementor : I1, I2
{
public void Method()
{
Trace.WriteLine("Method");
}
}
I1 i1 = new Implementor();
I2 i2 = new Implementor();
i1.Method();
i2.Method();
If you want separate methods per interface, implement them explicitly:
Code Snippet
public interface I1
{
void Method();
}
public interface I2
{
void Method();
}
public class Implementor : I1, I2
{
#region I1 Members
void I1.Method()
{
throw new NotImplementedException();
}
#endregion
#region I2 Members
void I2.Method()
{
throw new NotImplementedException();
}
#endregion
}
No comments:
Post a Comment