How can you make your C# code pretty?
Hi I was wondering if there is any tool that automatically make your source code pretty, like adding comment templates for each method, take care of spacing, tabs and whatnot?
Visual Studio, out of the box, has some formatting options, via Edit->Advanced->Format Selection and Edit->Advanced->Format Document. These primarily fix spacing, tabs, and similar issues, but won't add comments. It also has the ability to add XML doc comment stubs, but only for a single method at a time (type /// above a method, field, property, constructor, or type).
Tools like Resharper perform full Code Cleanup, which can do many of these things automatically.
In Visual Studio, the default hotkey for formatting code is ctrl+k+d. By typing in /// a comment template will be inserted based on context.
For example, typing in /// above a method with the signature static void Main(string args) will give the following:
/// <summary> /// /// </summary> /// <param name="args"></param> static void Main(string args)...