16 lines
472 B
Plaintext
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[] |