Reputation: 5194
Are there any settings in visual studio that enable the compiler to generate an error when a method or property hides a method or property from the base class without using the "new" keyword?
currently the compiler generates a warning
class A
{
void F(){ ... }
}
class B : A
{
void F(){ ... } //force build error because no "new" keyword is used
}
Thanks
Upvotes: 3
Views: 219
Reputation: 9469
Go into your project properties and set the radiobutton "treat warning as errors" to "all" or type the warning code you want in the dedicated textbox.
Upvotes: 4