Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create keyboard shortcut to regionate method

Can I in Visual Studio create keyboard shortcut to regionate method and auto-document it with 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
like image 758
Jan Remunda Avatar asked Sep 04 '09 11:09

Jan Remunda


2 Answers

I am not sure about the GhostDoc auto documentation, but to regionate selected text you can use the "surround with" function in 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.

This function can be used for a bunch of other stuff as well. If, for, while and try statements and so on.

like image 188
Sakkle Avatar answered Oct 28 '22 23:10

Sakkle


Type three slashes to auto-generate the documentation

like image 22
rJamil Avatar answered Oct 28 '22 23:10

rJamil