The Obsolete Attribute
A quickie. The Obsolete attribute marks a class or method as (pardon the redundancy) obsolete. Usage:
[System.Obsolete("This is an obsolete class; use NonObsoleteClassInstead")]public class ObsoleteClassExample{// Internals of the class}
Marking a Method Obsolete
public class NormalClass{// â¦[System.Obsolete("This method is absolute; use NonObsoleteMethodInSomeClass")]public void ObsoleteMethodExample(string blah){// Internals of the method}// â¦}
No, there isnât any difference in marking a class vs. method as obsolete. I just wanted to create two code blocks, go figure. :p
When you use a class/method marked as obsolete, VS 2005 shows you a nice warning in the âError Listâ pane.