Why is a semicolon instead of an empty block not always valid?

I have been wondering for a while; why is using an unacceptable half ;using a colon ;not always permissible? It works by using operators such as while, for, if, elseetc. But it does not work for try, catch, finallyand delegate(probably useful to leave blank).

So, let's do something like this:

while(shouldIWait()); // This is normal

try {
    doThing(); // Might throw an exception
} catch { } // Ignore the exception

But this is not so:

try {
    doThing(); // Might throw an exception
} catch; // Syntax error!

In my opinion, instead of an empty block, you can always use a half-hour. Why is this limited to certain statements? Is there a real difference between usage { }and ;operators?

+4
2

@JeppeStigNielsen:

#. . 8 "". , if ( 8.7.1) , try ( 8.10) . , (8.2). - (8.3). . 8.

, [, , if, while .. . , { }, ; .. try , (. 8).

Microsoft C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC#\Specifications\1033\ ( @JeppeStigNielsen).

+1

, .

( ).

( ). catch .

+1

All Articles