Language: C# | Type: CODE_SMELL | Severity: Info
Tags: obsolete
This rule is meant to be used as a way to track code which is marked as being deprecated. Deprecated code should eventually be removed.
The [System.Obsolete] attribute marks a type or member that should no longer be used. Code is deprecated for different reasons: it may
have been superseded by a better alternative, become outdated, expose a security weakness, or perform poorly.
[Obsolete("Use Bar() instead.")]
public void Foo() // Noncompliant: this deprecated method should be removed
{
}
Whatever the reason, every remaining usage carries that drawback into the codebase, and deprecated code usually stops receiving bug fixes and improvements. It is expected to be removed eventually, and when it is, every call site that still references it stops compiling — so the longer the references linger, the more expensive that change becomes.