NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

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

obsolete 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

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