The Obsolete Attribute : Obsolete Attribute « Attribute « C# / CSharp Tutorial





  1. The Obsolete attribute is short for System.ObsoleteAttribute
  2. The Obsolete attribute lets you mark a program element as obsolete.

It has this general form:

[Obsolete("message")]

A second form of Obsolete is shown here:

[Obsolete("message", error)]
  1. error is a Boolean value.
  2. If error is true, then the obsolete item generates a compilation error rather than a warning.










10.2.Obsolete Attribute
10.2.1.The Obsolete Attribute
10.2.2.Demonstrate the Obsolete attribute.
10.2.3.Obsolete attribute: warn the user that Method is obsolete
10.2.4.Obsolete attribute: throw an error if the user tries to use Method2
10.2.5.Using ObsoleteAttribute