Marks a program entity that should not be used.
[obsolete(message)] [obsolete(message, iserror)]
Any declaration that allows attributes.
obsolete is a single-use attribute. obsolete is an alias for System.ObsoleteAttribute.
When an entity marked obsolete is used in a program, the compiler issues either an error or a warning (depending on IsError) and prints out message.
using System; public class MyClass { [obsolete("Don't use OldWay; use NewWay instead", true)] static void OldWay() { Console.WriteLine("Silly me!"); } static void NewWay() { Console.WriteLine("D'oh!"); } public static void Main() { OldWay(); } }