Is there way for a class to \'remove\' methods that it has inherited?
E.g. if I don\'t want my class to have a ToString() method can I do something so t
You can throw a NotSupportedException, mark it as Obsolete and use EditorBrowsable:
[EditorBrowsable( EditorBrowsableState.Never )]
[Obsolete( "...", false )]
void YourMethod()
{
throw new NotSupportedException( "..." );
}
EDIT:
As pointed out by others: I describe a way to "disable" methods, but you have to think about carefully, where you want to use this. Especially throwing exceptions can be a very dangerous thing.