Oboslete attribute in C#


Oboslete attribute

Usually breaking changes in code are prepared through multiple releases to provide backward support for systems that are not so easy to change. To bring coming changes straight to IDE and compiler .NET Framework has Obsolete attribute that can be used to decorate code artifacts that will be or are replaced by something else.

Here is the example of obsolete method. Take a look at compiler output when running this demo.

Describing the change

The fact that method is obsolete is often not enough as developers want to know how to update their code. For this the obsolete attribute supports description that shortly communicates next steps to developers or points out where more guidance about coming change can be found.

Here is the example of obsolete attribute with decsription. Run the demo and check compiler output now.


Create your playground on
This playground was created on, our hands-on, knowledge-sharing platform for developers.
Go to