Base class method hidden (CA1061)
Ce contenu n’est pas encore disponible dans votre langue.
Key dotnet.codequality.base-method-hidden · Severity warning · Category codequality
Microsoft analyzer CA1061. Flags a method that hides a base-class method with a more general parameter type, so calls meant for the base method silently go to the new one.
Incorrect
Section titled “Incorrect”class Base { public void Save(string value) { } }class Derived : Base { public void Save(object value) { } }Correct
Section titled “Correct”class Base { public virtual void Save(string value) { } }class Derived : Base { public override void Save(string value) { } }