This question gives the answer that Java\'s @Override has the C# equivalent of the override
keyword on methods. However, since Java 1.6 the @Override annotation can
As stated, you cannot get that kind of control from an interface alone in C#. You could get it from an abstract class however. For the purpose of completeness, here is what you could do:
public interface IA
{
void Foo();
//void Bar(); - removed
}
public abstract class A : IA
{
virtual void Foo()
{ }
// Removed method
//virtual void Bar()
//{ }
}
public class B : A
{
public override void Foo()
{ }
//throws an error like the one you were receiving regarding no method to override.
public override void Bar()
{ }
}