Edit

Share via


Compiler warning (level 1) CS0612

'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:

C#
// 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  
   }  
}