Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Limit to #region nesting?
Message
From
13/09/2011 10:16:04
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
13/09/2011 10:06:46
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01523118
Message ID:
01523419
Views:
23
In that case, yes I would wrap it within a region giving me the ability to collapse it from sight and confusion. I have run accross them and did exactly that but later factored them out. In those cases, there was no logical value in having the class nested.

>Thanks,
>
>and yes I was referring to nested classes/ large array initializations in the context of regions - in those cases I tend to put them in a separate file (partial class)
>
>__
>
>>I am sure there is some case for nested classes, but I can't think of any and I don't do it. Structures yes, and if I could think of a good reason to nest a class I suppose I would consider it. Probably won't happen. Large array initializations? I don't have any thoughts about. Sounds like stub data to me.
>>
>>>Good point about the refactoring
>>>
>>>What would be your take (gustibus) with
>>>
>>>- large array initializations
>>>
>>>- nested classes
>>>
>>>__
>>>
>>>
>>>>Yes, C sharp has partial class files but I do not use them for general classes. I do not like looking in partial classes to find the code, I like it organized in a single code file for a class. However, I also keep my code limited in a class to what the class should be responsible for and refactor out any base code, etc. I do not have classes that contain thousands of lines of code. I use regions only to collapse specific areas like Viv mentioned that allows me to scroll much easier when needed or to just view some methods or ??.
>>>>
>>>>Thanks
>>>>
>>>>>Tim,
>>>>>
>>>>>I sometimes use several files to split
>>>>>
>>>>>>In my opinion the #region is goog organization of code and I use much the same as Viv. Using ReSharper helps navigate code but sometimes for instance if I have many properties in a class, collapsing the region around the properties makes the file more manageable to wonder through. I don't view it as hiding code, but rather just part of organizing.
>>>>>>Just another view point.
>>>>>>Timothy
>>>>>>
Timothy Bryan
Previous
Reply
Map
View

Click here to load this message in the networking platform