1

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
Votes + Comments
Good question.
6
Contributors
10
Replies
11
Views
6 Years
Discussion Span
Last Post by ChrisHunter
Featured Replies
  • 1
    ddanbe 2,613   6 Years Ago

    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# … Read More

  • 1

    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 … Read More

0

I think this feature is used just like comments mean using it or not is in users hand yes you are right this feature is amazing and gives a clean look to the program

0

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.

0

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#.

0

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.

Edited by pseudorandom21: n/a

1

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?

Edited by ddanbe: n/a

1

Regions are great, especially if you want to share your work with co-workers/other people. Regions, combined with xml commenting make for a very powerful and productive environment. Props to microsoft on doing something right (for once! :P)

1

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 :)

1

I agree with skatamatic, regions are greate for when sharing works with co-workers, means that you can label a section of code collaps it, makes your code look cleaner and a little less over-whelming to others.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.