Who is really need #Regions inside methods?

  • Thread starter Thread starter gaidar
  • Start date Start date
gaidar said:
Hi, everybody,

I'm just wondering if someone really need stuff like this:
http://msdn2.microsoft.com/library/ms123401.aspx. If you answer yes than
explain, please.

I've been too busy to keep up with what is proposed for VS2005.
But in VS2003, Regions "within" a method are not supported.
I find myself using them quite a bit, especially because I miss the Single
Procedure view of VB6.
I group related things, such as all the properties of a Class, and other
related procedures.
Keep things grouped, when they're finished off, just collapse them.
In rare cases, such as very long and complex methods where refactoring just
isn't appropriate, I think I would like the option to have regions "within"
a method as well.

Personally, I like them. However, with the proposed ability to break classes
into seperate files, I might choose that instead. If I had a Single
Procedure view still, I would probably use Regions less.

Gerald
 
I agree, they can definitely make code more organized. If a Class is very
long it can make editing code much easier by allowing you to fit the
procedures you are editing on your screen at the same time. Some people
might argue that this can be done without using #Region, which is true, but
when you have a large amount of related declarations or many small
procedures that are related to each other, it can be nice to have them
shrunken to a line that is a little more descriptive than the actual
declarations. I will admit that I have not yet used them, but I am also a
bit of an amature who uses VB.NET only for ASP.NET. But even if I don't use
them much in my own code, I am very glad they exist because the code that is
automatically generated by Visual Studio is usually put in a #Region, and
without that I would have to scroll down to find my own code in every page
every time I opened one, and as I mentioned, the descriptive part helps me
know why the automatically generated code is there.
 
Hi,

I think it would be nice to have.
Some functions or subs are so big that i would like to structure them a
bit with #Regions.
p.s. I use it a lot, and it makes long code much more readable, and
easier to find things back.

Regards
Peter
 
Peter Verijke said:
Some functions or subs are so big that i would like to structure them a
bit with #Regions.
p.s. I use it a lot, and it makes long code much more readable, and
easier to find things back.

Maybe you should refactor your code :-).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top