次の方法で共有


コンパイラ エラー CS1525

'term' は無効です

式の中に無効な項目が検出されました。 このエラーは、予期されている場所に式が欠落している、後続のトークンが式として誤って解析された、または式内で無効なコンストラクトが使われたことが原因で発生する可能性があります。 一般的な根本原因には、トークンの不一致、セミコロンの欠落、または余分な区切り記号などが含まれます。

次の例では CS1525 が生成されます。

// CS1525.cs
class MyClass
{
    public static void Method(int number) {}

    public static void Main()
    {
        int i = 0;
        i = i + 'c' + 1 + (2);   // OK
        i = i + void + throw;    // CS1525, these keywords are not valid in this expression

        Method(123,);            // CS1525, excess trailing comma

        goto EmptyLabel;
        EmptyLabel:              // CS1525, empty label
        // Add something here to resolve the error, for example:
        // System.Console.WriteLine("Hello!");
    }
}