Archive for the ‘Visual Studio 2005’ Category

Visual Studio Code Formatting

Well written code will have proper formatting & indentation. This helps to read the code much easier.

Visual Studio has built in features which automatically format the code as we write. It also provides customization features using which we can tell Visual Studio to How our code should be formatted. To do this we can make use of Options dialog.

To invoke this dialog click on menu item Tools -> Options. From Options dialog select Text Editor -> C# -> Formatting

Visual Studio 2008 Options Dialog

Visual Studio Options Dialog

We can format document using menu item Edit -> Advanced -> Format Document. Keyboard shortcut Ctrl + E, D