Why do methods with only one statement need braces?

public void Finalise()
    ProcessFinalisation(true);

Doesn't compile, but the correct version:

public void Finalise()
{
    ProcessFinalisation(true);
}

Compiles fine (of course).

If I am allowed if's without brackets when the following code has only one line:

if(true)
    CallMethod();

Why is the same not allowed for methods with one following line? Is there a technical reason?

8
задан Marc Gravell 16 May 2011 в 00:41
поделиться