S4225 — Extension methods should not extend "object"

Language
C#
Type
Code smell
Severity
Minor

Why is this an issue?

Creating an extension method that extends object is not recommended because it makes the method available on every type. Extensions should be applied at the most specialized level possible, and that is very unlikely to be object.

Noncompliant code example


public static class MyExtensions
{
    public static void SomeExtension(this object obj) // Noncompliant
    {
        // ...
    }
}

↑ Back to top