Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Limit to #region nesting?
Message
From
13/09/2011 09:01:23
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01523118
Message ID:
01523408
Views:
22
>>>>'wonder' would have been right for me. I wonder about my code a lot :-}
>>>
>>>LOL me too. (I mean my code, not yours, yours always looks good to me.)
>>>
>>>I use #region a lot once a class get's large enough.
>>>
>>>I'm probably a bit excessive, the change notification code makes properties fairly long in WPF, so I'll put each property into it's own #region and then wrap the whole properties section with a #region tag. But it makes it a lot quicker to find the property I'm looking for if I'm visually searching for it.
>>
>>I don't bother wrapping individual properties in a region - after all the are, themselves, collapsible. OTOH if your coding style involves placing a private backing variable next to the property declaration then wrapping the whole thing would appear cleaner.
>>
>>I sometimes use regions around catch code since native outling doesn't work there and, at least for me, it makes the normal flow of execution easier to follow. e.g:
try
>>{
>>}
>>#region Catch
>>catch (Exception ex)
>>{
>>}
>>#endregion
>
>Now there is food for thought, a region with one statement in it.

I run accross regions around a single line of code in this application and I just remove it. For me, there is no value to add two lines creating a region around a single line of code.
#region fields
private bool isMyField;
#endregion
This just simply does not add readability for me. I can see a case for Viv's idea on the Catch statements though. Hadn't thought about that.
Timothy Bryan
Previous
Reply
Map
View

Click here to load this message in the networking platform