I purchased 'The Elements of C# Style' a few years ago and it's an excellent book - I generally live by it when writing C# code.
As far as this discussion is concerned, Rule No. 12 is invoked (this is an extract) - 'Always use Block Statements in Control Flow Constructs' to avoid the 'dangling else' problem ...
I forgot about that book; good example too. Thanks Glenn.
I find when going over code I haven't worked on in a while, its easy to skip right over a single line of unbraced "else" code when there is a large block of "if-positive" code right above it. For internal consistency I only omit the braces where both are single-statements. If either require multiple lines they both get braced.
Solid approach, thanks dgorsman.
Hi, Michael
I have read in "Best code practice" article , don't remember where is it, but written by one of the giants ( I think by Petzold, not sure about )
"Better yet to use the brackets always"
Following sage Petzold advice could never be a bad thing (very much enjoy his writing too).
Bottom line ... whatever scheme one employs ... do it consistently.