How can a class marked as Deprecated/Obsolete in c# or vb.NET?
You can mark a class, method or property by adding the Obsolete Attribute above the declaration.


Sample C#

[Obsolete("This class should not be used anymore!",true)]
public class MyObsoleteClass

Sample VB.NET

<Obsolete("This class should not be used anymore!", True)> _
Public Class MyObsoleteClass
End Class


The second parameter of the attribute indicates whether the obsolete Class/Method/Property element usage is considered as error or not.



for more information see the MSDNĀ about ObsoleteAttribute Class

Leave a Reply