by Edward
20 October 2009 06:12
One of the annoying things I have been dealing with in Visual Studio 2008 and Framework 3.5, is the unnecessary "using" statements the IDE adds, when you add a new webpage to your project.
Visual Studio does give you the option to remove these unused using statements, but they do not "tell" you about it.
Here is a quick way of removing unused using statements.
From the Context Menu:
- 1) Right-click anywhere inside the code editor,
- 2) point to Organize Usings,
- 3) now click Remove Unused Usings.
Here is an example:
Before:
1: using System;
2: using System.Linq;
3: using System.Collections.Generic;
4: using System.Text;
5: using System;
6:
7: namespace ConsoleApplication1
8: {
9: class Program
10: {
11: static void Main(string[] args)
12: {
13: Console.WriteLine("DasCode.Net test page, removing
unused using statements");
14: }
15: }
16: }
After:
1: using System;
2:
3: namespace ConsoleApplication1
4: {
5: class Program
6: {
7: static void Main(string[] args)
8: {
9: Console.WriteLine("DasCode.Net test page, removing
unused using statements");
10: }
11: }
12: }