Remove and sort using statements

A lot of people don’t know this but you can actually clean up your using statements in your Visual Studio projects almost automatically.

In case you didn’t know, here is how to do it:

You have a big list of using statements in your class. It might look like this by default:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

Just do a right-mouse click on the using statements and select:
[Organize Usings] > [Remove and Sort].

This will remove all the unnecessary and unused usings. The result might look as clean as this:

using System.Windows.Controls;

Sometimes, nothing could be removed or sorted but in most new class files there are a lot of default usings. It might be good to clean them once in a while, especially if you wrote and removed lots of (test) code in a class.

Happy programming 😉

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s