Hiding the regions in Visual Studio
Ugh, regions. Kings of code obfuscation. Deans of dire design. Oh how thou hast scorned me with thine presence. But for a moment to brush thee aside, leave the code open wide,
cards against humanity black cards, for a browse or debuggery, yet with you, skullduggery. Ugh, regions. Foul captains of construction. Proud champions of chance. With thine secrets you hide, and all your insides. Hath you properties, say you? Yet a method or two, are well hidden within, where should I begin. Merchants of misuse. Avatars of abuse. Regions of reclus ive code are thee. Ugh, regions, may your use be sparse and your number, few. Ugh, regions.
You know why? You are somewhere in the code, you click F12 (go to definition), VS opens the file, points the cursor to the right place and the next second collapses the file. Terrific. So I have to click “Stop outlining”,
card for humanity, return to the original file,
places to buy cards against humanity, point to the object and make it “Go to definition” again. Why do I have to do it twice?
It’s unbelievably annoying to always have to de outline every single file every time you open it.
Who needs these regions actually? You have to be able to find what you need in file without regions, just use your dropdown lists with types and members. It’s a bit of brute force, but the idea is to comment all of the region markers, expanding the outline. The next step uncomments them,
cards against humanity cheap, returning them to their original state (not strictly true. could have rogue uses of region in other parts of the code). This code doesn’t return the Find Replace dialog back to it’s original state, either. With those caveats, this is the macro module that will perform this chore: