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
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: