Question

In Visual Studio 2010 we can Comment selected text via Ctrl+E,C - This prefixes selected lines with the double-slash.

Is there a way to select text and have VS2010 prefix the selected lines with a triple-slash?

For the curious; I am adding XML comments to my c# code. Specifically, I am adding example code within the <example><code></code></example> section of my comments. I'm am building the sample code in a throw-away console app (just to make sure I'm creating code that works). When satisfied with the sample code, I copy/paste it into my app that I'm adding XML Comments to. When I paste the sample code, I have to manually add all the triple-slashes. I'm getting kinda bored doing this, so I'm hoping there is a way I can have VS2010 do this for me.

Was it helpful?

Solution

There is no built-in command to do that, AFAIK.
However, you can do it using VS's built-in advanced text-editing features.

Hold down Alt, select a zero-width column of text at the beginning of the lines, then type ///. This will type into all of the lines simultaneously.

You can select that with the keyboard by pressing Home (as applicable), then repeatedly pressing Alt+Shift+.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top