How To Remove Unused Usings in Visual Studio
There are two ways to remove unused using from our code . Remove Unused Usings option in Visual Studio removes unused using in our code .
The first way is :
1) Main Menu – On the Edit menu, point to IntelliSense, point to Organize Usings, and then click Remove Unused Usings.
![Remove unused usings_1](http://www.programmingposts.com/wp-content/uploads/2013/04/Remove-unused-usings_1.jpg)
2) Context Menu – Right-click anywhere inside the code editor, point to Organize Usings, and then click Remove Unused Usings.
![Remove unused usings_2](http://www.programmingposts.com/wp-content/uploads/2013/04/Remove-unused-usings_2.jpg)
The following example shows the outcome of performing Remove Unused Usings on source code.
After:
Before:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
using System; using System.Linq; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("Hello World"); } } } |
After:
1 2 3 4 5 6 7 8 9 10 11 12 |
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("Hello World"); } } } |