aAarErCXBW| 7VCW

Obsolete.` The Obsolete attribute generates a compile-time warning. When a method has the Obsolete attribute, the C# compiler issues a warning if it is called. This helps keep programs correct. This makes it easier to transition from old methods.`Example.` To begin, the Obsolete attribute is found in the System namespace. It is an attribute type, which means you can specify the type as Obsolete or ObsoleteAttribute. The suffix "Attribute" is automatically added at compile-time. `Using System `system`To specify an attribute,` decorate a method with the declaration and surround the attribute with square brackets. You can use the Obsolete attribute with zero, one, and two arguments. `Next: `This attribute example uses one argument, and it generates a compile-time warning.`Attributes are invoked` the same way as constructors. The Obsolete attribute can have zero arguments. In this case, a generic compile-time warning is generated. It can have one argument—a specific warning is generated. `Finally: `It can instead have two arguments. The compilation fails if you specify true as the second argument.`Summary.` Obsolete is useful for versioning. If you have developed a new control flow and a certain method is no longer wanted, you can decorate it with the Obsolete attribute, and then correct warnings or errors as you go along. `In larger projects this can help coordinate the methods different programmers employ.

ETIRNIITDTQTbTJTAI{IET%E{IEEMTgA();IE}IIE[NObsoleteN(RUse MTgB insteadR)]IET?TcMTgA()IE{IE}I}IINIITlwarning CS0618: 'TA.MTgA()' is obsolete: 'Use MTgB instead'N

!bObsolete attribute