共用方式為


編譯器錯誤 CS0619

更新:2007 年 11 月

錯誤訊息

'member' 已經過時: 'text'

類別成員被標記為 Obsolete 屬性 (Attribute),因此若是參考該類別成員,就會發出一個錯誤。

下列範例會產生 CS0619:

// CS0619.cs
using System;

public class C
{
   [Obsolete("Use newMethod instead", true)]   // generates an error on use
   public static void m()
   {
   }

   // this is the method you should be using
   public static void newMethod()
   {
   }
}

class MyClass
{
   public static void Main()
   {
      C.m();   // CS0619
   }
}