Marking things as deprecated in VB.Net

If you have some old classes/methods that you can’t get rid off, but you dont’ want anyone to use them for new development, you should mark them as deprecated, which can be done with the Obsolete tag:

<Obsolete("Don't use this class")> _
Public Class Whatever

End Class

This will cause any reference to Whatever to produce a warning.  You can treat these as errors if you want by using one of the other constructors like this:

<Obsolete("Don't use this class", True) > _
Public Class Whatever

End Class

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s