共用方式為


編譯器錯誤 CS0655

更新:2007 年 11 月

錯誤訊息

'parameter' 不是有效的屬性參數型別,因此不是有效的具名屬性引數

請參閱屬性 (C# 程式設計手冊),以取得屬性 (Attribute) 的有效參數型別的相關討論。

範例

下列範例會產生 CS0655:

// CS0655.cs
using System;

class MyAttribute : Attribute
{
    // decimal is not valid attribute parameter type
    public decimal d = 0;
    public int e = 0;
}

[My(d = 0)]   // CS0655
// Try the following line instead:
// [My(e = 0)]
class C
{
    public static void Main()
    {
    }
}