Code inspection: Parameter can be declared with the base type
This inspection reports a method parameter declared as a concrete type even though the method only uses it through a base type or interface. Using the less specific type makes the API more flexible without changing the method's behavior.
Example
interface IFoo
{
void Run();
}
class Foo : IFoo
{
public void Run() { }
}
class C
{
private static void Execute(Foo foo)
{
foo.Run();
}
}
interface IFoo
{
void Run();
}
class Foo : IFoo
{
public void Run() { }
}
class C
{
private static void Execute(IFoo foo)
{
foo.Run();
}
}
Quick-fix
Change the parameter type to the suggested base type or interface.
29 March 2026