And of course there are keyboard shortcuts to deal with the regions:Ĭollapse or expand the block you're currently in. It is possible to configure the Visual Studio IDE to not fold any of the regions when files are opened, but this is the out of box behavior, so that's what most developers will see. Immediately I have a problem: I can't see anything! I have to manually expand those sections to browse any of the code in this class. Here's a random example from the Log4Net project: Any code placed inside that region is, by default, collapsed when you re-open it in the editor. So what is #region? It's a named hint you place in C# or VB.NET code to set a code folding point. I tried to make myself clear in this twitter message: For me, the use of #region is one of those things. If that's the case, try to clear the air and address those strong preferences up front, as early as possible. Still, there are some coding preferences people may feel. It's a very short trip indeed from there to Who Wrote This Crap, and the predictable, inevitable finger-pointing at the foolhardy programmers who came before you begins. I've always been wary of cowboy coders who rolled into an ongoing project on fresh horses and immediately started dictating terms. As they say, when in Rome, do as the Romans do. It promotes team harmony, and more than that, it's just common courtesy. Not everyone has to agree on every miniscule detail of the code, of course, but it's a good idea to dicuss it with your team and decide on overall approaches and philosophy beforehand. You can take the shortcut keys to a whole new level using Auto Hot Keys, read it here.Ĭlick here, for more detailed cheat sheet on various tools and technique.When you join a team, it's important to bend your preferences a little to accommodate the generally accepted coding practices of that team. There are yet many more amazing shortcuts but these are my favorite, hope these are helpful in your programming career. When the code is shabby and does not have proper spacing and indents, use this shortcut and see the Magic. Too large code base? Minimize the code and find it easy to navigate through the code. Tired of copy-scroll-paste, copy-scroll-paste? You can replace it with copy-copy-scroll-paste-paste by using this shortcut
0 Comments
Leave a Reply. |