Ignoring Interface method implementation in C#

c#, oop

Solution

You can avoid implementing it (a valid scenario) but not ignore it altogether (a questionable scenario).

public interface IFoo
{
    void A();
    void B();
}

// This abstract class doesn't know what to do with B(), so it puts
// the onus on subclasses to perform the implementation.
public abstract class Bar : IFoo
{
    public void A() { }
    public abstract void B();
}

Problem

Suppose an Interface `I` has two methods. For example `Method1()` and `Method2()`. A class `A` Implements an Interface `I`. Is it possible for class `A` to implement only `Method1()` and ignore `Method2()`? I know as per rule class `A` has to write implementation of both methods. I am asking if there any way to violate this rule?

Original source