Results 1 to 4 of 4

Thread: Obsolete Attribute

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Obsolete Attribute

    I want to apply an Attribute to a method which is obsolete. Is this the proper way to do this. I don't have Visual Basic .Net yet so im guessing. Thanks.
    Code:
    Public Class Boo
    
    Private String strMentalState
    
     <Obsolete("Scare is obsolete, Use Startle instead")>Public Property Scare() As String
     Get
       Return strmMentalState  
     End Get
     Set(ByVal strMentalState  As String)
      Me.strMentalState = strMentalState 
     End Property
    
     Public Function Startle() As String
    
     End Function
    
     Sub Main()
          Dim b Boo = New Boo()
          b.Scare("arghhhhh")
     End Sub 
    
    End Class

  2. #2
    Hyperactive Member
    Join Date
    Dec 2001
    Location
    Dublin, Ireland
    Posts
    262
    Yep thats it.

  3. #3

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Thanks Musician i wasn't too sure. One more thing if the class is marked with <System.ObsoleteAttribute("")> would that make every method contained within the class obsolete? Thanks

  4. #4
    Hyperactive Member
    Join Date
    Dec 2001
    Location
    Dublin, Ireland
    Posts
    262
    I only know of Obsolete and System.Obsolete is just the full namespace of the attribute - i.e. they are the same thing. You should search on msdn but it doesn't seem to be very well documented.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width