Code inspection: Convert static method invocation into extension member call
This inspection identifies extension method calls that use static method syntax and suggests converting them to the more natural and readable extension method invocation syntax.
Extension methods in C# allow you to "add" methods to existing types without modifying their source code. While they can be called using static method syntax (ClassName.Method(instance)), the preferred approach is using instance method syntax (instance.Method()), which improves code readability and follows C# best practices.
public static class Utils
{
public static void Foo(this object c)
{
// do something
}
}
public class Sample
{
public Sample(object obj)
{
Utils.Foo(obj);
}
}
public static class Utils
{
public static void Foo(this object c)
{
// do something
}
}
public class Sample
{
public Sample(object obj)
{
obj.Foo();
}
}
09 January 2026