KnowDotNet NetRefactor

Ending Brace Comments

Did you ever wonder, while looking at about six row of closing braces ( } ), which of the closing braces was associated with a preceding if, for, do, while, switch, etc.? Did you ever manually place a comment after a closing brace so that you could associate it with its opening brace and the if, for, do, while, switch, etc., that initiated it? For example, compare the first block of braces and compare it with the second block.

   ....is this easy to decipher?
         }
       }
     }
   }
   ...or is this a little better???
         } // for
       } // if
     } // while
   } // method: DemoBraces


CSharpCompleterPlus provides the ability to automatically insert braces, which is one of the foundational features of the add-in. Additionally, CSharpCompleterPlus can annotate the closing braces with a comment that denotes the construct which initiated the sequence.
You can turn this feature on or off in the Setup form of
CSharpCompleterPlus.

Writing Add-Ins for Visual Studio .NET
Writing Add-ins for Visual Studio .NET
by Les Smith
Apress Publishing