68

Is there an ability in VB.NET to deprecate code? I know that in C# there are 'attributes', and tags in java; is there anything similar in VB.NET, other than leaving a 'todo:...?

brasskazoo
  • 76,030
  • 23
  • 64
  • 76

2 Answers2

138

There are attributes in VB.NET too:

Looks like this (before your function)

<Obsolete("This method is deprecated, use XXXX instead.")> _ 

And since VB.NET 10 (.NET 4 and later) we no longer need the underscore.

<Obsolete("This method is deprecated, use XXXX instead.")>
Sebastian Brosch
  • 42,106
  • 15
  • 72
  • 87
Lou Franco
  • 87,846
  • 14
  • 132
  • 192
8

Use the [Obsolete] Attribute.

Otávio Décio
  • 73,752
  • 17
  • 161
  • 228