Many a times we often come across unformatted code, which is almost impossible to understand. For instance, some lines of code may be indented properly while others might not be. Visual Studio provides a great feature for auto-formatting your unformatted code. Just press
Ctrl+K followed by
Ctrl+D and voila the code is now in a well-indented, easy to understand format. It works for markup code like HTML, XML etc. as well as for language codes such as C# and VB.
If you have code like this:
<table><tr><td>val1</td><td>val2</td></tr></table>
It can be auto-formatted to:
<table>
<tr>
<td>
val1</td>
<td>
val2</td>
</tr>
</table>
So, next time you copy some code from the net you can easily reformat it by using the key combination. Alternately, you can also use
Ctrl+K followed by
Ctrl+F.
No comments:
Post a Comment