The Obsolete attribute
The attribute Obsolete is used to mark types and members of types that should no longer be used. namespace System public ObsoleteAttribute(string message) {...} public ObsoleteAttribute(string message, bool error) {...} public string Message { get {...} } public bool IsError { get {...} } If a program uses a type or member that is decorated with the Obsolete attribute, the compiler issues a warning or an error. Specifically, the compiler issues a warning if no error parameter is provided, or if the error parameter is provided and has the value false. The compiler issues an error if the error parameter is specified and has the value true. In the example [Obsolete("This class is obsolete; use class B instead")] class B class Test the class A is decorated with the Obsolete attribute. Each use of A in Main results in a warning that includes the specified message, “This class is obsolete; use class B instead.”
|