ObsoleteAttribute is applicable to all program elements except assemblies, modules, parameters or return values. Marking an element as obsolete informs the users that the element will be removed in future versions of the product.

using System;
publicsealedclass App {
staticvoid Main() {
// The line below causes the compiler to issue a warning:// 'App.SomeDeprecatedMethod()' is obsolete: 'Do not call this method.'
SomeDeprecatedMethod();
}
// The method below is marked with the ObsoleteAttribute. // Any code that attempts to call this method will get a warning.
[Obsolete("Do not call this method.")]
privatestaticvoid SomeDeprecatedMethod() { }
}