Add Block Delimiters - Peter's Software House

Add Block Delimiters

   1: // This code is hard to read.
   2: if (results != null) {
   3:     if (results.Contains(aId)) results.Remove(aId);
   4:     results.Add(aId, aResult);
   5: }

 

But if you have Refactor Pro!, you can do the following:

image

and the result is much more readable:

   1: // Much better
   2: if (results != null) {
   3:     if (results.Contains(aId))
   4:     {
   5:         results.Remove(aId);
   6:     }
   7:     results.Add(aId, aResult);
   8: }
Published Friday, April 24, 2009 9:25 AM by Pieter

Comments

# re: Add Block Delimiters

This one is a religious issue :-)

Seriously, I have slowly been converted to not using parentheses for single-line blocks. I do ensure that all statements have their own line though:

if(a ==b)

 doSomething();

else

 doSomethingElse();

Monday, May 04, 2009 9:20 AM by codingsanity

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: