Embedded statement cannot be a declaration or labeled statement

You have a statement (if or while, for example), right before the code you posted, without curly braces. For example: is correct, but the code below: will result in CS1023: Embedded statement cannot be a declaration or labeled statement. UPDATE The reason, according to @codefrenzy, is that the newly declared variable will immediately go out of scope, … Read more