DevPinoy.org
A Filipino Developers Community
ATTENTION:Take our Code Challenge for the month of October 2008 and win some great prize! Learn more about it here!

collapsible code sections (#region, #endregion)

visual studio .net comes with the #region and #endregion directives to be able to collapse code sections using the IDE.  by default, the generated code (i.e. InitializeComponent method block) which is used by winform and webform designer to recreate the forms at design time are enclosed in this block since developers should not manipulate it and it is rare for developers to view them at the code editor.  it's primary purpose is code readability when used properly.

i have seen developers abusing this feature.  There are some who wants to segregate properties, constructors, eventhandlers and methods using this feature up to the worst scenario where each routine is enclosed in a region block (no offense but for pete's sake, you can use the class view to see an outline of the interface of your classes with a number of grouping options and you can even double click on the signature and the editor brings you to the code declaration)

although there is an option to collapse region blocks when a code sheet is opened (Tools->Options->Text Editor->C#->Outlining->Collapse #region blocks when files open.), you can only choose between collapsing them all or expand them all when a code sheet is opened.  the primary purpose of selective code view of the #region block is sometimes defeated.  i'm a very O-C coder and every misused feature like this eats my time.

below are the ideal things (in my opinion) that need to be enclosed in a #region block
- designer generated code
- interface implementation


Posted Nov 30 2005, 12:28 PM by jokiz
Filed under: , ,

Comments

Work at home moms resource wahmpros. wrote Work for stay at home moms.
on 05-27-2008 10:15 PM

Work at home moms. Top work at home moms. Soy tarts work at home moms. Wahm com the online magazine for work at home moms. Moms work at home. Work at home moms message boards. Christian work at home christian work at home moms.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?

Enter the numbers above:

Copyright DevPinoy 2005-2008
Powered by Community Server (Commercial Edition), by Telligent Systems