Obsolete attribute : Attribute « Language Basics « VB.Net






Obsolete attribute

 
Imports System
Imports System.Text
Imports System.Text.RegularExpressions


Public Class MainClass
    Shared Sub Main(  )
       Dim d As Demo = New Demo()
       d.Method1()

    End Sub 'Main

   
End Class

  <Serializable()> Public Class Demo

    <Obsolete("Use Method2 instead.")> Public Sub Method1()
    End Sub

    <System.ObsoleteAttribute("Use Method2 instead.", True)> Public Sub Method2()
      'Old implementation
    End Sub

    Public Sub Method3()
      ' New implementation ...
    End Sub

  End Class

  <Serializable(), Obsolete("No longer used.")> Public Class Test
  End Class

           
         
  








Related examples in the same category

1.Define and use Attribute to track bugsDefine and use Attribute to track bugs
2.Attribute Class represents the base class for custom attributes.