In stumbled on this about a month ago.
In C# you can make a block inside of a method that is not attached to any other statement.
public void TestMethod()
{
{
string x = "test";
string y = x;
{
int z = 42;
int zz = z;
}
}
}
This code compiles and runs just as if the braces inside the main method weren't there. Also notice the block inside of a block.
Is there a scenario where this would be valuable? I haven't found any yet, but am curious to hear of other people's findings.