Compiler Error CS1023
Embedded statement cannot be a declaration or labeled statement
An embedded statement, such as the statements following an if statement, can contain neither declarations nor labeled statements.
The following sample generates CS1023 twice:
// CS1023.cs
public class a
{
public static void Main()
{
if (1)
int i; // CS1023, declaration is not valid here
if (1)
xx : i++; // CS1023, labeled statement is not valid here
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: