編譯器錯誤 CS0633
更新:2007 年 11 月
錯誤訊息
'attribute' 屬性的引數必須是有效的識別項
傳遞給 ConditionalAttribute 或 IndexerNameAttribute 屬性 (Attribute) 的任何引數都必須是有效的識別項。這表示不能含有 "+" 之類的字元,這些字元出現在辨識項時不合法。
範例
以下範例使用 ConditionalAttribute 說明 CS0633。下列範例會產生 CS0633。
// CS0633a.cs
#define DEBUG
using System.Diagnostics;
public class Test
{
[Conditional("DEB+UG")] // CS0633
// try the following line instead
// [Conditional("DEBUG")]
public static void Main() { }
}
以下範例使用 IndexerNameAttribute 說明 CS0633。
// CS0633b.cs
// compile with: /target:module
#define DEBUG
using System.Runtime.CompilerServices;
public class Test
{
[IndexerName("Invalid+Identifier")] // CS0633
// try the following line instead
// [IndexerName("DEBUG")]
public int this[int i]
{
get { return i; }
}
}