View only one method?
In VB you had the option to view only one method (or sub, in VB) so that the rest of the code outside your current method wasn't seen. Is this possible in visual studio 2010 for C#?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Apr 20, 2011, 8:15 AM EDT
In the case of C# I don't think there is even a way to separate methods by lines. However, VS is full of hidden options so if somebody else knows a way I'd be interested to know what it is.
You can, of course, do various forms of collapsing and outlining as you probably know already.
Charles Morissette29 reputationPosted Apr 20, 2011, 9:00 AM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Apr 20, 2011, 11:17 AM EDT
Perhaps what you are looking for is "Ctrl-}". Put the cursor before or after a "{" or a "}" and then press "Ctrl-}" (or "Ctrl-]", which is the same thing). That will scroll to the matching symbol; try it and see. I use that to get the entire block to be shown, or scroll the window so the block fills the window more. Try it and I hope you see what I mean.
Charles Morissette29 reputationPosted Apr 20, 2011, 11:19 AM EDT
If you chose the one with multiple small lines, it showed you your entire project - if your chose the one with two small lines, it showed you only your current sub/method. Was quite nifty, too bad it doesn't seem I can find it in Visual Studio.