rspec/rules/S4225/csharp/rule.adoc

19 lines
499 B
Plaintext
Raw Normal View History

== Why is this an issue?
2022-07-25 13:40:35 +02:00
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
2022-07-25 13:40:35 +02:00
[source,csharp]
----
public static class MyExtensions
{
public static void SomeExtension(this object obj) // Noncompliant
{
// ...
}
}
----
include::../rspecator.adoc[]