Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Regions: Love or Hate

Regions: Love or Hate

Scheduled Pinned Locked Moved The Lounge
csharpcssvisual-studiocollaborationhelp
93 Posts 63 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Dave Kerr

    I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...

    N Offline
    N Offline
    NormDroid
    wrote on last edited by
    #5

    I initially thought they where a good idea, now I don't bother with them. I suppose the only place they are good for is Microsoft Generated Code from the IDE etc.

    Software Kinetics Wear a hard hat it's under construction
    Metro RSS

    K 1 Reply Last reply
    0
    • D Dave Kerr

      I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...

      F Offline
      F Offline
      Firo Atrum Ventus
      wrote on last edited by
      #6

      I've seen regions being abused (hiding shitty code to make it look clean), overused (why would you keep a method in a region?) and underused (as in, WTF? why would you hide all your code in a region titled "main process"). So I can safely say "I.HATE.THAT.SH*T!"

      Excuse me for my improper grammar and typos. It's because English is my primary language, not my first language. My first languages are C# and Java. VB, ASP, JS, PHP and SQL are my second language. Indonesian came as my third language. My fourth language? I'm still creating it, I'll let you know when it's done! :-D

      D T 2 Replies Last reply
      0
      • F Firo Atrum Ventus

        I've seen regions being abused (hiding shitty code to make it look clean), overused (why would you keep a method in a region?) and underused (as in, WTF? why would you hide all your code in a region titled "main process"). So I can safely say "I.HATE.THAT.SH*T!"

        Excuse me for my improper grammar and typos. It's because English is my primary language, not my first language. My first languages are C# and Java. VB, ASP, JS, PHP and SQL are my second language. Indonesian came as my third language. My fourth language? I'm still creating it, I'll let you know when it's done! :-D

        D Offline
        D Offline
        Dave Kerr
        wrote on last edited by
        #7

        I see the same thing, regions used to hide rubbish, black holes that you never want to go near...

        1 Reply Last reply
        0
        • D Dave Kerr

          I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...

          G Offline
          G Offline
          GuyThiebaut
          wrote on last edited by
          #8

          I have a love hate relationship with them - they can hide what I don't need to see when I am looking at significant code :) they also hide the code within a region from the find dialogue box :mad:

          Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
          G N 2 Replies Last reply
          0
          • D Dave Kerr

            I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...

            S Offline
            S Offline
            Slacker007
            wrote on last edited by
            #9

            Dave Kerr wrote:

            What's the public opinion - are regions good or bad?

            I like them. However, like any code style, your team needs to ALL be on the same sheet of music.

            Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)

            OriginalGriffO 1 Reply Last reply
            0
            • D Dave Kerr

              I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...

              OriginalGriffO Offline
              OriginalGriffO Offline
              OriginalGriff
              wrote on last edited by
              #10

              I wasn't sure until I started using them to group related items in the same file: Fields Properties Constructors Event handlers Public properties Private properties Now I find it reduces the clutter, and lets you see what you are interested in, without being distracted by irrelevancies. So much so that I modified the VS default class (and so forth) files to include them as standard. There is a Tip/Trick about it here: Adding your items to Visual Studio default files[^]

              Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
              "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

              M R D D L 7 Replies Last reply
              0
              • G GuyThiebaut

                I have a love hate relationship with them - they can hide what I don't need to see when I am looking at significant code :) they also hide the code within a region from the find dialogue box :mad:

                Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                G Offline
                G Offline
                Gary Wheeler
                wrote on last edited by
                #11

                GuyThiebaut wrote:

                they also hide the code within a region from the find dialogue box :mad:

                Check the 'search hidden text' box in the Find dialog.

                Software Zen: delete this;

                G 1 Reply Last reply
                0
                • S Slacker007

                  Dave Kerr wrote:

                  What's the public opinion - are regions good or bad?

                  I like them. However, like any code style, your team needs to ALL be on the same sheet of music.

                  Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)

                  OriginalGriffO Offline
                  OriginalGriffO Offline
                  OriginalGriff
                  wrote on last edited by
                  #12

                  Slacker007 wrote:

                  your team needs to ALL be on the same sheet of music

                  Oh yes! Nothing worse than one idiot individual who insists on K&R bracket format when everyone else has got an IQ bigger than their shoe size moved on to a more readable style.

                  Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                  G Q B N S 6 Replies Last reply
                  0
                  • D Dave Kerr

                    I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...

                    T Offline
                    T Offline
                    Tom Deketelaere
                    wrote on last edited by
                    #13

                    I like them but only if used with common sense. Like Digital Man I get to enforce the standards and I'v "implemented" a few regions that everybody now uses. It makes finding specific code easier. But like with everything if you use them to much or to little they don't make sense at all.

                    1 Reply Last reply
                    0
                    • D Dave Kerr

                      I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...

                      G Offline
                      G Offline
                      Gary Wheeler
                      wrote on last edited by
                      #14

                      I use them to break up groups of members/fields. It's nice to be able to collapse stuff away when I'm not concerned with it.

                      Dave Kerr wrote:

                      Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...

                      I wouldn't want them to be mandated in order to support Visual Studio features.

                      Software Zen: delete this;

                      1 Reply Last reply
                      0
                      • D Dave Kerr

                        I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...

                        R Offline
                        R Offline
                        RugbyLeague
                        wrote on last edited by
                        #15

                        I like them in my code, I find them irritating in the code of others

                        1 Reply Last reply
                        0
                        • OriginalGriffO OriginalGriff

                          I wasn't sure until I started using them to group related items in the same file: Fields Properties Constructors Event handlers Public properties Private properties Now I find it reduces the clutter, and lets you see what you are interested in, without being distracted by irrelevancies. So much so that I modified the VS default class (and so forth) files to include them as standard. There is a Tip/Trick about it here: Adding your items to Visual Studio default files[^]

                          Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

                          M Offline
                          M Offline
                          Mustafa Ismail Mustafa
                          wrote on last edited by
                          #16

                          That is exactly what I do!

                          If the post was helpful, please vote, eh! Current activities: Playing Star Craft II. Don't bother me, eh? Now and forever, defiant to the end. What is Multiple Sclerosis[^]? Food[]

                          1 Reply Last reply
                          0
                          • G Gary Wheeler

                            GuyThiebaut wrote:

                            they also hide the code within a region from the find dialogue box :mad:

                            Check the 'search hidden text' box in the Find dialog.

                            Software Zen: delete this;

                            G Offline
                            G Offline
                            GuyThiebaut
                            wrote on last edited by
                            #17

                            Thank you :)

                            Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                            G 1 Reply Last reply
                            0
                            • D Dave Kerr

                              I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...

                              R Offline
                              R Offline
                              realJSOP
                              wrote on last edited by
                              #18

                              I like regions to a point. I think they would be more useful if we could set their background color to something other than the white space color.

                              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                              -----
                              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                              -----
                              "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                              Q 1 Reply Last reply
                              0
                              • G GuyThiebaut

                                Thank you :)

                                Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                                G Offline
                                G Offline
                                Gary Wheeler
                                wrote on last edited by
                                #19

                                In your defense, I didn't find it for a while. I think the box in the Find dialog should be labelled "search within collapsed regions", or something like that.

                                Software Zen: delete this;

                                G 1 Reply Last reply
                                0
                                • D Dave Kerr

                                  I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...

                                  D Offline
                                  D Offline
                                  DaveAuld
                                  wrote on last edited by
                                  #20

                                  I tend to only use them if there is a lot happening on the code, and when i do use them, it is for the purpose of grouping like things together e.g. all button click methods together all menu.... all toolbar.... all statusbar.... all public properties together all private fields together like everything else though, each to there own, unless of course you are working to agreed coding guidelines as a group.

                                  Dave Find Me On: Web|Facebook|Twitter|LinkedIn


                                  Folding Stats: Team CodeProject

                                  1 Reply Last reply
                                  0
                                  • G GuyThiebaut

                                    I have a love hate relationship with them - they can hide what I don't need to see when I am looking at significant code :) they also hide the code within a region from the find dialogue box :mad:

                                    Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                                    N Offline
                                    N Offline
                                    NormDroid
                                    wrote on last edited by
                                    #21

                                    GuyThiebaut wrote:

                                    they also hide the code within a region from the find dialogue box :mad:

                                    Yes another compelling reason to avoid them.

                                    Software Kinetics Wear a hard hat it's under construction
                                    Metro RSS

                                    1 Reply Last reply
                                    0
                                    • G Gary Wheeler

                                      In your defense, I didn't find it for a while. I think the box in the Find dialog should be labelled "search within collapsed regions", or something like that.

                                      Software Zen: delete this;

                                      G Offline
                                      G Offline
                                      GuyThiebaut
                                      wrote on last edited by
                                      #22

                                      .Net is my hobby - I think if I was doing this for a living then it would be rather more embarrassing - thanks for your help :)

                                      Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                                      1 Reply Last reply
                                      0
                                      • D Dave Kerr

                                        I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...

                                        J Offline
                                        J Offline
                                        jim lahey
                                        wrote on last edited by
                                        #23

                                        Regions are a necessary evil. I find them helpful for grouping related or similar blocks of code within a file. Using

                                        ctrl + k + s

                                        and

                                        ctrl + m + p

                                        takes a lot of the pain out of them.

                                        1 Reply Last reply
                                        0
                                        • D Dave Kerr

                                          I used to love regions, stuck them everywhere in my code. Now I hate them, each member of our team uses them differently. What's the public opinion - are regions good or bad? Would they be better if they were REALLY big in Visual Studio? I find that I'm squinting to find the little buggers, if they were much more obvious I might get lost less...

                                          A Offline
                                          A Offline
                                          Abhinav S
                                          wrote on last edited by
                                          #24

                                          Try remembering the following and you should be ok. (of course these may be different based on your settings)

                                          Ctrl + M, M - Toggle Outlining expansion
                                          Ctrl + M, L - Toggle all outlining
                                          Ctrl + M, P - Stop outlining
                                          Ctrl + M, Ctrl + U - stop hiding current
                                          Ctrl + M, O - Collapse to definitions

                                          Too much of heaven can bring you underground Heaven can always turn around Too much of heaven, our life is all hell bound Heaven, the kill that makes no sound

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups