How to jump to the region header from the endregion tag in c# visual studio 2012?

流过昼夜 提交于 2019-11-27 17:39:22

问题


If i have the following

#region
blah;
blahblah;
.....
moar;
#endregion

how can i jump to the top #region label if i see the #endregion tag on my screen?

Is there a short cut?


回答1:


The answer is Ctrl + ] as already answered by @TheEvilPenguin.

But I thought to add this awesome link for other shortcuts as well, which can be helpful in speeding up routine tasks in VS.

EDIT : Save the link page as html in your system, as the link might expire in future.




回答2:


Ctrl+] will jump between the start and end of blocks. I just tested, and it works for #region blocks for me in VS2010.

Edit: The relevant command is Edit.GoToBrace




回答3:


For Visual Studio 2015, Ctrl + ] doesn't work anymore. But you can use the following:

  1. Click on region
  2. And use following shortcuts: Ctrl + shift + ↑ and Ctrl + shift + ↓



回答4:


I don't believe there's a standard shortcut in Visual Studio.

Within Visual Studio's options dialog, I did a search through all available commands for anything containing the word "region":

But didn't find anything related to navigation, just expand/collapse.

Addins like Resharper and CodeRush may give you what you want, if you have the budget for it. (And they do a lot more besides.)



来源:https://stackoverflow.com/questions/13521604/how-to-jump-to-the-region-header-from-the-endregion-tag-in-c-sharp-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!