473,791 Members | 3,154 Online
Bytes | Software Development & Data Engineering Community
+ 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 3070
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.goo gle.com...
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.UserContr ol ctl = new System.Windows. Forms.UserContr ol();
Nov 16 '05 #3
William Ryan eMVP <do********@com cast.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.co m>
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
7137
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 functionality to that library, finetune it, and see how things work. Well, the problem is that the library is quite huge, so the application's size gets not really acceptable - I'm developping for an
7
13356
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
4015
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
7190
by: Tom McL. | last post by:
Is there a way I identify and remove unused variable within vb2005 standard edition
12
9626
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 Try/Catch, and the Catch for each one references the ex exception variable. Yet it is still flagged as unused? What gives?
1
1670
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 compile error:
31
8624
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
9765
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 needed which causes the compiler to spit out a "helpful" warning. For example: % cat unused.c #include <stdio.h> int foo(char *str, void *data) {
1
4049
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). #include <stdio.h> #define UNUSED _attribute_ ((unused)) void testUnused(int a UNUSED, int b); int main()
0
9669
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9997
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9030
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.