rspec/rules/S4225/csharp/rule.adoc
2022-07-25 13:40:35 +02:00

16 lines
472 B
Plaintext

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
[source,csharp]
----
public static class MyExtensions
{
public static void SomeExtension(this object obj) // Noncompliant
{
// ...
}
}
----
include::../rspectator.adoc[]