Thoughts on #region
Hello all, a lot of times I see C# code written without the use of #region and #endregion, I'm just wondering if there is any reason not to use it, and what are your thoughts on using it.
I think it's an amazing feature that lets you clearly identify groups of functions/classes with similar functionality.
i.e.,
#region PROGRAM_INIT
//Functions to initialize variables, etc.
#endregion
#region STRUCTION
//ctor
//dtor
#endregion
#region EVENTS
//Program events go here.
#endregion
pseudorandom21
Practically a Posting Shark
890 posts since Jan 2011
Reputation Points: 216
Solved Threads: 111
I agree with you both. Amazing feature of the editor in VS. I used to work with this editor .
I can tell you not only #region is an improvement. :|
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
Hey I've used VI before, it's supposed to be "powerful" somehow, but I never figured out how. It certainly isn't intuitive, or at least, the version that I used.
pseudorandom21
Practically a Posting Shark
890 posts since Jan 2011
Reputation Points: 216
Solved Threads: 111
VI sure had its merrits in the previous century. Once you got used to it, it worked very well. Don't ask me to do anything in it now, commands all lost!
I could not miss VS, intellisence, #region and all the other goodies to program in C#.
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
You can also enable collapsing of things such as for loops inside of functions (for C/C++ at least).
on VS2010:
tools -> options -> text editor -> C/C++ -> Formatting -> Outlining ->
set Outline statement blocks = true.
and not to get off topic, but if someone uses F# could you give me some information about your experience learning it, or at least learning a functional language in general.
pseudorandom21
Practically a Posting Shark
890 posts since Jan 2011
Reputation Points: 216
Solved Threads: 111
I am currently reading:
Real World Functional Programming: With Examples in F# and C# [Paperback] Tomas Petricek (Author) Jon Skeet (Author)
I must say it is quite an experience(the good way that is :) )
I would not consider this book something to learn F# with, but it compares F# and C# very well.
It will take some time to get used to, just like the VI commands.;)
Perhaps this site will consider a F# forum in the near future?
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
Yes I think that's a good idea also.
pseudorandom21
Practically a Posting Shark
890 posts since Jan 2011
Reputation Points: 216
Solved Threads: 111
I'm currently reading 3 F# books (one of which is an updated version from F# 1.1 to F# 2.0). Doing things in F# takes a little getting used to (all values are immutable be default). Some of the ideas have carried over into my C# programming (no side effects!). I believe it's worth-while to learn :)
Momerath
Nearly a Senior Poster
3,384 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558