编译器错误 CS0619
“member”已过时:“text”
类成员标记有 Obsolete 特性,这样,当引用类成员时,将发出错误。
以下示例生成 CS0619:
using System;
public class C
{
[Obsolete("Use NewMethod instead", true)] // generates an error on use
public static void OldMethod()
{
}
// this is the method you should be using
public static void NewMethod()
{
}
}
class MyClass
{
public static void Main()
{
C.OldMethod(); // CS0619
}
}