Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 1) CS0612 

Error Message

'member' is obsolete

The class designer marked a member with the Obsolete attribute. This means that the member might not be supported in a future version of the class.

The following sample shows how accessing an obsolete member generates CS0612:

// CS0612.cs
// compile with: /W:1
using System;

class MyClass
{
   [Obsolete]
   public static void ObsoleteMethod()
   {
   }

   [Obsolete]
   public static int ObsoleteField;
}

class MainClass
{
   static public void Main()
   {
      MyClass.ObsoleteMethod();    // CS0612 here: method is deprecated
      MyClass.ObsoleteField = 0;   // CS0612 here: field is deprecated
   }
}

Community Additions

ADD
Show:
© 2014 Microsoft