JetBrains Rider 2024.1 Help

Code Inspection: Redundant class or interface specification in base types list

Category

Redundancies in Symbol Declarations

ID

RedundantExtendsListEntry

EditorConfig

resharper_redundant_extends_list_entry_highlighting

Default severity

Warning

Language

C#

Requires SWA

No

If the list of base types in a class declaration contains types that are in an inheritance relationship, JetBrains Rider issues the warning about redundant specification of a type. Since inheritance in C# is transitive, it is enough to specify the type from which your class derives directly.

In the example below, specifying IFoo in the declaration of MyClass is not necessary because MyClass inherits IFoo from its base class BaseClass. Therefore, JetBrains Rider suggests removal of IFoo from the list of base types of MyClass.

public class BaseClass : IFoo { } public class MyClass : BaseClass, IFoo { }
public class BaseClass : IFoo { } public class MyClass : BaseClass { }
Last modified: 17 April 2024