PDA

Click to See Complete Forum and Search --> : Obsolete Attribute


Dillinger4
Jul 29th, 2002, 02:48 PM
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. :p

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

Musician
Jul 29th, 2002, 03:56 PM
Yep thats it.

Dillinger4
Jul 29th, 2002, 04:05 PM
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 :)

Musician
Jul 29th, 2002, 05:28 PM
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.