﻿<?xml version="1.0" encoding="utf-8"?><Type Name="ObsoleteAttribute" FullName="System.ObsoleteAttribute" FullNameSP="System_ObsoleteAttribute" Maintainer="ecma"><TypeSignature Language="ILASM" Value=".class public sealed serializable ObsoleteAttribute extends System.Attribute" /><TypeSignature Language="C#" Value="public sealed class ObsoleteAttribute : Attribute" /><TypeSignature Language="ILAsm" Value=".class public auto ansi serializable sealed beforefieldinit ObsoleteAttribute extends System.Attribute" /><MemberOfLibrary>BCL</MemberOfLibrary><AssemblyInfo><AssemblyName>mscorlib</AssemblyName><AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]</AssemblyPublicKey><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ThreadingSafetyStatement>All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.</ThreadingSafetyStatement><Base><BaseTypeName>System.Attribute</BaseTypeName></Base><Interfaces /><Attributes><Attribute><AttributeName>System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event | System.AttributeTargets.Interface | System.AttributeTargets.Delegate | System.AttributeTargets.All, Inherited=false)</AttributeName></Attribute><Attribute><AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName></Attribute></Attributes><Docs><example><para>The following example demonstrates the usage of <see cref="T:System.ObsoleteAttribute" /> to
   generate a compile-time warning.</para><code lang="C#">
   
using System;

public class ObsoleteAttributeExample {

  [ObsoleteAttribute("OldMethod is being removed: use NewMethod in future versions.")]
  public static void OldMethod() {

    //Execute some code here
  }

  public static void Main() { 

    OldMethod();
  }
}
</code><para>An example compile-time result is</para><para><c>ObsoleteAttributeExample.cs(8,4):
   warning CS0618: 'ObsoleteAttributeExample.OldMethod()' is obsolete: 'OldMethod is
   being removed: use NewMethod in future versions.'</c></para></example><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para><see cref="T:System.ObsoleteAttribute" /> is applicable to all program elements except assemblies, modules, parameters, and return values. Marking an element as obsolete informs users that the element will be removed in future versions of the product.</para><para>The <see cref="T:System.ObsoleteAttribute" /> class includes two properties:</para><list type="bullet"><item><para><see cref="P:System.ObsoleteAttribute.Message" />. The string assigned to the <see cref="P:System.ObsoleteAttribute.Message" /> property is emitted by the compiler when the attribute target is used in code. The string should note that the attribute target is obsolete and, if possible, provide some workaround or programmatic alternative. </para></item><item><para><see cref="P:System.ObsoleteAttribute.IsError" />. This is a Boolean value that indicates to the compiler whether using the <see cref="T:System.ObsoleteAttribute" /> attribute should cause it to emit an error (<see cref="P:System.ObsoleteAttribute.IsError" /> is true) or a warning (<see cref="P:System.ObsoleteAttribute.IsError" /> is false).  </para></item></list><para>For more information about using attributes, see <format type="text/html"><a href="30386922-1E00-4602-9EBF-526B271A8B87">[&lt;topic://cpconExtendingMetadataUsingAttributes&gt;]</a></format>.</para><format type="text/html"><h2>win8_appname_long Apps</h2></format><para>When you create a Windows Metadata library (.winmd file), the <see cref="T:System.ObsoleteAttribute" /> is exported as both the <see cref="T:System.ObsoleteAttribute" /> attribute and the <see cref="http://msdn.microsoft.com/library/windows/apps/windows.foundation.metadata.deprecatedattribute.aspx">Windows.Foundation.Metadata.DeprecatedAttribute</see> attribute if only the <see cref="T:System.ObsoleteAttribute" /> is present in source code. The <see cref="T:System.ObsoleteAttribute" /> is transformed to the DeprecatedAttribute as follows:</para><list type="bullet"><item><para>If the <paramref name="message" /> and <paramref name="error" /> arguments are both present, <paramref name="message" /> is assigned to the DeprecatedAttribute <paramref name="message" /> argument. An error value of true maps to <see cref="http://msdn.microsoft.com/library/windows/apps/windows.foundation.metadata.deprecationtype.aspx">DeprecationType.Remove</see>, and an <paramref name="error" /> value of false maps to <see cref="http://msdn.microsoft.com/library/windows/apps/windows.foundation.metadata.deprecationtype.aspx">DeprecationType.Deprecate</see>. </para></item><item><para>If the <paramref name="message" /> argument is not supplied in the <see cref="T:System.ObsoleteAttribute" />, its default value in the DeprecatedAttribute is "element_name is deprecated", where element_name is the name of the target program element to which the attribute is applied. </para></item><item><para>If the <paramref name="error" /> argument is not present in the <see cref="T:System.ObsoleteAttribute" />, its default value in the DeprecatedAttribute is <see cref="http://msdn.microsoft.com/library/windows/apps/windows.foundation.metadata.deprecationtype.aspx">DeprecationType.Deprecate</see>.  </para></item></list><block subset="none" type="note"><para>Directly applying the <see cref="http://msdn.microsoft.com/library/windows/apps/windows.foundation.metadata.deprecatedattribute.aspx">Windows.Foundation.Metadata.DeprecatedAttribute</see> attribute to managed code is not recommended, because this export occurs automatically. </para></block></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Marks the program elements that are no longer in use. This class cannot be inherited.</para></summary></Docs><Members><Member MemberName=".ctor"><MemberSignature Language="ILASM" Value="public rtspecialname specialname instance void .ctor()" /><MemberSignature Language="C#" Value="public ObsoleteAttribute ();" /><MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /><MemberType>Constructor</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue /><Parameters /><Docs><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>The following table shows the initial property values for an instance of <see cref="T:System.ObsoleteAttribute" />.</para><list type="table"><listheader><item><term><para>Property </para></term><description><para>Value </para></description></item></listheader><item><term><para><see cref="P:System.ObsoleteAttribute.IsError" /></para></term><description><para>false </para></description></item><item><term><para><see cref="P:System.ObsoleteAttribute.Message" /></para></term><description><para>null </para></description></item></list></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Initializes a new instance of the <see cref="T:System.ObsoleteAttribute" /> class with default properties.</para></summary></Docs><Excluded>0</Excluded></Member><Member MemberName=".ctor"><MemberSignature Language="ILASM" Value="public rtspecialname specialname instance void .ctor(string message)" /><MemberSignature Language="C#" Value="public ObsoleteAttribute (string message);" /><MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message) cil managed" /><MemberType>Constructor</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue /><Parameters><Parameter Name="message" Type="System.String" /></Parameters><Docs><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>The following table shows the initial property values for an instance of <see cref="T:System.ObsoleteAttribute" />.</para><list type="table"><listheader><item><term><para>Property </para></term><description><para>Value </para></description></item></listheader><item><term><para><see cref="P:System.ObsoleteAttribute.IsError" /></para></term><description><para>false. </para></description></item><item><term><para><see cref="P:System.ObsoleteAttribute.Message" /></para></term><description><para>The workaround message. </para></description></item></list></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Initializes a new instance of the <see cref="T:System.ObsoleteAttribute" /> class with a specified workaround message.</para></summary><param name="message"><attribution license="cc4" from="Microsoft" modified="false" />The text string that describes alternative workarounds. </param></Docs><Excluded>0</Excluded></Member><Member MemberName=".ctor"><MemberSignature Language="ILASM" Value="public rtspecialname specialname instance void .ctor(string message, bool error)" /><MemberSignature Language="C#" Value="public ObsoleteAttribute (string message, bool error);" /><MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, bool error) cil managed" /><MemberType>Constructor</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue /><Parameters><Parameter Name="message" Type="System.String" /><Parameter Name="error" Type="System.Boolean" /></Parameters><Docs><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>The following table shows the initial property values for an instance of <see cref="T:System.ObsoleteAttribute" />.</para><list type="table"><listheader><item><term><para>Property </para></term><description><para>Value </para></description></item></listheader><item><term><para><see cref="P:System.ObsoleteAttribute.IsError" /></para></term><description><para>The <paramref name="error" /> value. </para></description></item><item><term><para><see cref="P:System.ObsoleteAttribute.Message" /></para></term><description><para>The workaround message. </para></description></item></list></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Initializes a new instance of the <see cref="T:System.ObsoleteAttribute" /> class with a workaround message and a Boolean value indicating whether the obsolete element usage is considered an error.</para></summary><param name="message"><attribution license="cc4" from="Microsoft" modified="false" />The text string that describes alternative workarounds. </param><param name="error"><attribution license="cc4" from="Microsoft" modified="false" />The Boolean value that indicates whether the obsolete element usage is considered an error. </param></Docs><Excluded>0</Excluded></Member><Member MemberName="IsError"><MemberSignature Language="ILASM" Value=".property bool IsError { public hidebysig specialname instance bool get_IsError() }" /><MemberSignature Language="C#" Value="public bool IsError { get; }" /><MemberSignature Language="ILAsm" Value=".property instance bool IsError" /><MemberType>Property</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Boolean</ReturnType></ReturnValue><Parameters /><Docs><value><para><see langword="true" /> if the 
 compiler treats usage of the target
 of the current instance
 as an error; otherwise, <see langword="false" />.</para></value><remarks><para>This property is read-only.</para><para>The default value of this property is <see langword="false" />.</para></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Gets a Boolean value indicating whether the compiler will treat usage of the obsolete program element as an error.</para></summary></Docs><Excluded>0</Excluded></Member><Member MemberName="Message"><MemberSignature Language="ILASM" Value=".property string Message { public hidebysig specialname instance string get_Message() }" /><MemberSignature Language="C#" Value="public string Message { get; }" /><MemberSignature Language="ILAsm" Value=".property instance string Message" /><MemberType>Property</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.String</ReturnType></ReturnValue><Parameters /><Docs><value><para>A <see cref="T:System.String" /> that contains
   suggested workarounds
   for the target of the current instance.</para></value><remarks><para>This property is read-only.</para><para>The current instance contains a suggested workaround message if and only if
      such a message was specified when the current instance was constructed. If
      no workaround was specified for the current instance, the value of
      this property is <see langword="null" />.</para></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Gets the workaround message, including a description of the alternative program elements.</para></summary></Docs><Excluded>0</Excluded></Member></Members><TypeExcluded>0</TypeExcluded></Type>