At times when we create a new code block for an existing class/function/method and want all to use that instead of the old one, And also since you cannot delete it since that is being used in some other parts, we need to set that class/method as obsolete so that we can specify others to use the new one.
We need to mark the method or class with the [Obsolete] attribute.
Ex:
[Obsolete("Don't use this because...Some reason here")]
class MyClass { }
If you want to error out then]
[Obsolete("Don't use this because..Some reason.", true)]
class MyClass { }