473,466 Members | 1,381 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can remove unused using directive?

How to remove unused using directive?

eg)

using System;
using System.Windows.Forms; <- i want to remove this unused using directive

namespace foo
{
:
:
}
Nov 16 '05 #1
3 3057
I'm not sure I understand what you mean but taken literally, you can just
delete it. If it's not being used at all, then there won't be any problems
associated with deleting it or commenting it out. Somehow I'm guessing this
isn't what you meant though so if you could let me know the end goal, I can
probably be of more help.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com

"Apollo440" <za****@hotmail.com> wrote in message
news:95**************************@posting.google.c om...
How to remove unused using directive?

eg)

using System;
using System.Windows.Forms; <- i want to remove this unused using directive
namespace foo
{
:
:
}

Nov 16 '05 #2
Apollo440 wrote:

How to remove unused using directive?

eg)

using System;
using System.Windows.Forms; <- i want to remove this unused using directive

namespace foo
{
:
:
}


Rip it out. That's all there is to it.

If get compile errors, then apparently you had some code that was still using
that namespace.

Note that stictly speaking you don't need _any_ using statements, you can just
prepend all types w/ the necessary namespace:

From:

using System.Windows.Forms;
UserControl ctl = new UserControl();

To:

System.Windows.Forms.UserControl ctl = new System.Windows.Forms.UserControl();
Nov 16 '05 #3
William Ryan eMVP <do********@comcast.nospam.net> wrote:
I'm not sure I understand what you mean but taken literally, you can just
delete it. If it's not being used at all, then there won't be any problems
associated with deleting it or commenting it out. Somehow I'm guessing this
isn't what you meant though so if you could let me know the end goal, I can
probably be of more help.


I suspect Apollo was after the kind of feature Eclipse has had in its
Java development tooling for ages - "organise imports" which sorts the
import statements alphabetically (with preferences to let you separate
out your own imports from system ones and 3rd party ones, etc) and
removes any unused ones. Very handy - I sincerely hope something like
that is in Whidbey.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Maxim | last post by:
Greetings, In my C# project, I'm using a third-party Opensource library... in source code form. I mean no assemblies, just pure source code. It allows me to add new application-specific...
7
by: sanjana | last post by:
hi i wanna detect if a anything is connected to the usb port I am using system.management class for tht purpose this is my code class usbdetect { public static void Main() {
2
by: AussieRules | last post by:
Hi, There use to be some 3rd party tools that would remove unused subs and function and unused code from vb projects. Is there are a way to do this in vb.net 03
3
by: Tom McL. | last post by:
Is there a way I identify and remove unused variable within vb2005 standard edition
12
by: zacks | last post by:
Suddenly, in a VB2005 project I am working on, several variables show up in the list of warnings are being unused local variables. But they all are. Several of them are the ex variable used in a...
1
by: silverburgh.meryl | last post by:
Hi, I have this piece of code which calls STL remove(): _aList.erase(remove(_aList.begin(), _aList.end(), bd), _aList.end()); where _aList is a 'vector<A*>' and bd is 'A*' But i get this...
31
by: smachin1000 | last post by:
Hi All, Does anyone know of a tool that can automatically analyze C source to remove unused #includes? Thanks, Sean
13
by: Rex Mottram | last post by:
I'm using an API which does a lot of callbacks. In classic callback style, each routine provides a void * pointer to carry user-defined data. Sometimes, however, the user-defined pointer is not...
1
by: dissectcode | last post by:
I am trying to learn how to use the attribute unused so I created a little test program. Can you please tell me what is wrong? I get syntax errors "before attribute" and "before (" (sometimes). ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.