C#-NoHidingOfBaseClassMethods

Do not hide a base method by a method in a derived type

Required inputs: CSharpAST

This rule reports the following scenario: A type T derives (directly or indirectly) from type TP, and an instance method m) is declared in T with the same name and number of parameters as an instance method in TP. The types of the parameter match except for one or more parameters, where the type of T.m is more common than the type of TP.m.
If the option report_only_more_specific_hidings is set to false, also hidings are reported where all parameter types coincide. If the option report_if_parameters_have_generic_parameter_type is set to true, and the parameter types of at least one pair of corresponding parameters are both generic parameters, the method is reported even if all other parameter types coincide.

Possible Messages

Key

Text

Severity

Disabled

method_hides_identical_method

Method hides a base method with identical signature.

None

False

method_hides_more_specific_method

Method hides a base method with a more specific signature.

None

False

Options

report_if_parameters_have_generic_parameter_type

report_if_parameters_have_generic_parameter_type : bool = True

If True and the parameter types of at least one pair of corresponding parameters are both generic parameters, report the method even if all other types are equal.
 

report_only_more_specific_hidings

report_only_more_specific_hidings : bool = True

If True, also hidings are reported where all parameter types coincide.