Nota
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba mendaftar masuk atau menukar direktori.
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba menukar direktori.
Invalid expression term 'term'
The compiler detected an invalid term in an expression. This error can be caused by a missing expression where one is expected, leading to subsequent tokens being wrongly parsed as an expression, or an invalid construct is used within an expression. Common root causes include unmatched tokens, missing semicolon or excess delimiters.
The following sample generates 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!");
}
}