共用方式為


編譯器錯誤 CS0653

更新:2007 年 11 月

錯誤訊息

因為是抽象的,無法套用屬性類別 'class'

抽象自訂屬性 (Attribute) 類別不可做為屬性使用。

下列範例會產生 CS0653:

// CS0653.cs
using System;

public abstract class MyAttribute : Attribute
{
}

public class My2Attribute : MyAttribute
{
}

[My]   // CS0653
// try the following line instead
// [My2]
class MyClass
{
   public static void Main()
   {
   }
}