Blog

Remove Unused Usings from a Class

Posted by Sandeep Singh Shekhawat Blogs | Visual Studio 2010 Feb 14, 2013
In this blog I explain that How can remove unused using visual studio.

We create a Web Form in Visual Studio, a .cs file means code file class is automatically create. That .cs file means class has default usings for namespace.

using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;

 But generally we don't use all namespaces  in that class so we want remove unused namespaces from file. We can remove  namespace manually but it takes time and need full knowledge of class library so we can use Visual Studio .

Step 1:  Right Click in .cs File.

Step 2:  Move on Organize usings.

Step 3: Click on Remove Unused Usings.

1.PNG

After that we have only those namespaces in the file these are using.

post comment
     

Nice tip.I didnt know that! i use Resharper instead of it.It changes color of unused statements to gray.

Posted by Ibrahim Ersoy Apr 15, 2013

nice tip...

Posted by Rishikesh Kumar Singh Feb 15, 2013
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Join a Chapter