
Marks the program elements that are no longer in use. This class cannot be inherited.
Assembly: mscorlib (in mscorlib.dll)
'Declaration <SerializableAttribute> _ <ComVisibleAttribute(True)> _ <AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Struct Or AttributeTargets.Enum Or AttributeTargets.Constructor Or AttributeTargets.Method Or AttributeTargets.Property Or AttributeTargets.Field Or AttributeTargets.Event Or AttributeTargets.Interface Or AttributeTargets.Delegate, Inherited := False)> _ Public NotInheritable Class ObsoleteAttribute _ Inherits Attribute
ObsoleteAttribute is applicable to all program elements except assemblies, modules, parameters or return values. Marking an element as obsolete informs the users that the element will be removed in future versions of the product.
For more information about using attributes, see Extending Metadata Using Attributes.
The following example defines a class that contains a method marked with the ObsoleteAttribute. Any code that attempts to call the method will cause the compiler to issue a warning.
Module Module1 Sub Main() ' The line below causes the compiler to issue a warning: ' 'App.SomeDeprecatedMethod()' is obsolete: 'Do not call this method.' SomeDeprecatedMethod() End Sub ' The method below is marked with the ObsoleteAttribute. ' Any code that attempts to call this method will get a warning. <Obsolete("Do not call this method.")> Private Sub SomeDeprecatedMethod() End Sub End Module
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements..NET Framework
Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0.NET Framework Client Profile
Supported in: 4, 3.5 SP1Example:
#pragma warning disable 618

- 7/23/2010
- Marc Selis
- 8/1/2010
- Thomas Lee
