nedcomp hosting homepage

Producten en Diensten
Dedicated servers
Datacenter informatie
Partners, resellers
Helpdesk informatie
Technische docs, tools
Support homepage
ASP componenten
Praktische ASP, ASP.NET
Visual route server
Whois (domein gegevens)
Software documentatie
Whitepapers
Zoeken
Nedcomp / algemeen

Zoeken
 

Copyright © Nedcomp Hosting
Telefoon nr :   +31 184 670111
Fax nummer :   +31 184 631384
E-mailadres :   info@nedcomp.nl
 

C# Programmer's Reference  

Obsolete

Marks a program entity that should not be used.

[Obsolete(
   message
)]
[Obsolete(
   message,
   iserror
)]

Parameters

message
A string; ideally, a human-readable explanation of why the item is obsolete and what to use instead.
iserror
A bool; if true, the compiler should treat the use of the item as an error. Default value is false (compiler generates a warning).

Applies To

Any declaration that allows attributes.

Remarks

The Obsolete attribute is a single-use attribute. Obsolete is an alias for System.ObsoleteAttribute.

When an entity marked Obsolete is used in a program, the compiler issues either an error or a warning (depending on iserror) and prints out message.

Example

// cs_attribute_obsolete.cs
// CS0619 expected
using System;
public class MyClass 
{
   [Obsolete("Don't use OldWay; use NewWay instead", true)]
   static void OldWay( ) { Console.WriteLine("Silly me!"); }
   static void NewWay( ) { Console.WriteLine("D'oh!"); }
   public static void Main( ) 
   {
      OldWay( );
   }
}

See Also

C# Attributes