I need to inherit from a basic abstract class. I want to override only one method. But Visual Studio oblige me to override them all, So I am overriding more than 10 methods that throw NonImplementedException
, I find it stupid. Isn't there any way to override only what I need. Or at least to tell Visual Studio to override the rest (non implemented methods and properties)?
The base class is written by the framework so I can't change it (I am talking about RoleProvider
of ASP.NET MVC)
abstract class Base
{
public void Method1()
{
//some code
} // No need to override
public abstract void Method2(); // must be overriden
public virtual void Method3()
{
// some code
} // Not necessarily be overriden
}
class Derived : Base
{
}
Here the compiler will only ask you to override
Method2()
as a mandate. It won't ask you to override Method1()
or Method3()
. You can override
Method3()
as it bears keyword virtual
though.