更新:2007 年 11 月
错误消息
“attribute”属性的参数必须是有效的标识符
传递给 ConditionalAttribute 或 IndexerNameAttribute 属性的任何参数都必须是有效的标识符。这意味着它不能包含出现在标识符中时非法的字符,如“+”。
示例
此示例使用 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; }
}
}