Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which "useing System..." is necessary? 1

Status
Not open for further replies.

jslmvl

Vendor
Jan 26, 2008
268
GB
Hi,

In a Windows Forms Application, I found many "useing System...". I think not every one is necessary. How can I know which one can be removed?

Thank you for your help.
 
if you delete the line and the code does not compile, then you need it. Or if you are using a plug-in like R# it will highlight the extraneous using statements, along with a plethora of other IDE goodness.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Sorry, want more:
If I modify my program and realise that I need to put or put back a "using...", how to know which "using..." I need?
 
modify and release... never. you always want to test your application. the worst case is manually testing the changes (F5) and making sure the system works. A better solution is to create automated tests which you can execute and verify a majority of the system within seconds/minutes. you still need to manually tests, but the automation can ensure most of the system (especially business logic) is working correctly.

after testing locally, deploy to a test server/client. this will help work out the kinks with a true distinction between the client/server. during development your box is both the server and the client and it's easy for security and infrastructure bugs to masked.

after the application works in the testing environment you can deploy into production.

you should never deploy straight from your local development copy to production.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
i say all that, but in the case of removing unused namespaces. if the code doesn't compile you cannot deploy, so tests, in the sense of automated or manual, aren't needed for this this specific modification. in general though, you should test your changes before deploying.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Also, comment out all using lines. IF your program needs the particular using line and it's commented out, you should get errors immediately. Uncomment what you need. After you've compiled/run/tested you app, you can go back and delete those commented lines.
 
The current version of Visual Studio has options to 'sort' and/or 'delete unused' "using" statements from source files.

Can't remember which menu this is on (and can't check as I'm away from base).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top