visual-studio 创建区域方法的键盘快捷键
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1378606/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Create keyboard shortcut to regionate method
提问by Jan Remunda
Can I in Visual Studio create keyboard shortcut to regionate method and auto-document it with GhostDoc?
我可以在 Visual Studio 中创建区域方法的键盘快捷方式并使用 GhostDoc 自动记录它吗?
From this:
由此:
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}
I want make this:
我想做这个:
#region protected override void OnInit(EventArgs e)
/// <summary>
/// Raises the <see cref="E:Init"/> event.
/// </summary>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}
#endregion
回答by Sakkle
I am not sure about the GhostDoc auto documentation, but to regionate selected text you can use the "surround with" function in Visual Studio.
我不确定 GhostDoc 自动文档,但要对所选文本进行区域划分,您可以使用 Visual Studio 中的“环绕”功能。
Select a portion of code and press Ctrl+ K, S. This brings up the "surround with" context menu. Select "region" in the menu, type in your region name and you're all set.
选择一部分代码,然后按Ctrl+ K、S。这会调出“环绕”上下文菜单。在菜单中选择“地区”,输入您的地区名称,一切就绪。
This function can be used for a bunch of other stuff as well. If, for, while and try statements and so on.
这个函数也可以用于一堆其他的东西。if、for、while 和 try 语句等等。
回答by rJamil
Type three slashes to auto-generate the documentation
键入三个斜杠以自动生成文档

