共用方式為


編譯器錯誤 CS0307

更新:2007 年 11 月

錯誤訊息

'construct' 'identifier' 不是泛型方法。如果您要的是運算式清單,請在 < 運算式前後加括號。

命名的建構不是型別或方法;型別和方法是唯一能取得泛型引數的建構。請移除角括弧中的型別引數。如果需要泛型,請將泛型建構宣告為泛型型別或方法。

下列範例會產生 CS0307:

// CS0307.cs
class C
{
   public int P { get { return 1; } }
   public static void Main()
   {
      C c = new C();
      int p = c.P<int>();  // CS0307 – C.P is a property
      // Try this instead
      // int p = c.P;
   }
}