Monday, September 29, 2008

Here's a great Auto-Format key combo

Auto-Format your Code in Visual Studio

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.
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: