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?

Thanks

Answers


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

Need Your Help

Find out where a multi-threading C# program is stuck

c# visual-studio debugging

I have written a C# program having some thousand lines and several threads. Execution works fine for several hours/days until the application, which is running on a Windows server, starts to slow

How do I convert numpy NaN objects to SQL nulls?

python postgresql psycopg2

I have a Pandas dataframe that I'm inserting into an SQL database. I'm using Psycopg2 directly to talk to the database, not SQLAlchemy, so I can't use Pandas built in to_sql functions. Almost

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.