更新:2007 年 11 月
错误消息
无效的表达式项“character”
编译器在表达式中检测到了无效字符。
下面的示例生成 CS1525:
// CS1525.cs
class x
{
public static void Main()
{
int i = 0;
i = i + // OK - identifier
'c' + // OK - character
(5) + // OK - parenthesis
[ + // CS1525, operator not a valid expression element
throw + // CS1525, keyword not allowed in expression
void; // CS1525, void not allowed in expression
}
}
空白标签也可能会生成 CS1525,如以下示例所示:
// CS1525b.cs
using System;
public class MyClass
{
public static void Main()
{
goto FoundIt;
FoundIt: // CS1525
// Uncomment the following line to resolve:
// System.Console.Write("Hello");
}
}