473,776 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using References

Heres a noob question. Does it waste system resources if you include
using statements at the top of the code page, but your code never uses
them ? For example should you go through every .cs file and remove any
references that are not being used ?

using System;
using System.Data;
using System.Configur ation;
using System.Collecti ons;
using System.Componen tModel;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;

Thanks.
Jul 30 '08 #1
4 1502
TheLostLeaf,

No, not at all.

The using statement just allows you to use short name for a type when
using it in your code. Types in the namespace in the "using" statement
don't need to have the full namespace syntax.

It should be noted that using statements are NOT references. It's
simply a way of allowing you to use the short type name instead of the
namespace-qualified type name.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"TheLostLea f" <er**@canyondig ital.comwrote in message
news:98******** *************** ***********@v39 g2000pro.google groups.com...
Heres a noob question. Does it waste system resources if you include
using statements at the top of the code page, but your code never uses
them ? For example should you go through every .cs file and remove any
references that are not being used ?

using System;
using System.Data;
using System.Configur ation;
using System.Collecti ons;
using System.Componen tModel;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;

Thanks.

Jul 30 '08 #2
No, it's just a way of writing shorter code

List x

instead of

System.Collecti ons.List x

Pete
Jul 30 '08 #3
Nicholas Paldino [.NET/C# MVP] <mv*@spam.guard .caspershouse.c omwrote:
No, not at all.

The using statement just allows you to use short name for a type when
using it in your code. Types in the namespace in the "using" statement
don't need to have the full namespace syntax.

It should be noted that using statements are NOT references. It's
simply a way of allowing you to use the short type name instead of the
namespace-qualified type name.
Just as a further point of pedantry, those are using directives, not
using statements. Using statements are the ones which call Dispose
automatically :)

On everything else, I agree with Nicholas entirely.

--
Jon Skeet - <sk***@pobox.co m>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Jul 30 '08 #4
TheLostLeaf wrote:
Heres a noob question. Does it waste system resources if you include
using statements at the top of the code page, but your code never uses
The compiler will use extra resources and possibly take longer (probably not
measurably), the application it creates won't.
them ? For example should you go through every .cs file and remove any
references that are not being used ?

using System;
using System.Data;
using System.Configur ation;
using System.Collecti ons;
using System.Componen tModel;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;

Thanks.

Aug 6 '08 #5

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

Similar topics

10
2131
by: teddysnips | last post by:
Application is a Work Tracking/Timesheet database. The increments of work are stored in the TimesheetItem table. This contains, inter alia, the Work Code, the Start and the Duration that the employee spent that day on a particular project. Some employees in the Network Support Department don't complete a standard 7.5 hour day for various reasons, so for every Network Support person I need to update these particular days with an amount...
4
4584
by: clintonG | last post by:
When using Visual Studio.NET I observe adding a new Web Form may have default References added such as... References o- System o- System.Data o- System.Drawing o- System.Web o- System.XML
15
4779
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update button will verify the information that has been entered and updates the data base if the data is correct. Update will throw an exception if the data is not validate based on some given rules. I also have a custom error handling page to show the...
2
3059
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is what I'm hoping to achieve. I've never before had to use Javascript closures, but now I do, so I'm making an effort to understand them. I've been giving this essay a re-read: http://jibbering.com/faq/faq_notes/closures.html
0
1308
by: DWoood | last post by:
Background: We have been developing a Web Services Project (let's call it "MyServices") for several months and have had no problems with it. In fact other members of my team are still developing in MyServices just fine. This is only an issue on my box. A day or two ago, something changed in VS or IIS (not in code) and I cannot identify it. I have re-fetched the source code of MyServices numerous times from Source Control and it...
1
4867
by: Simon | last post by:
Dear reader, Some times I receive an error message by using the functions: Left(;2) Mid(;5;2)
8
2173
by: Bruce | last post by:
I am using VB in Vs2005. Am I missing something or does VB not have the concept of "builds" (release/debug) like in VC? I wrote an assembly and I would like to have a debug version of the DLL and a release version of the DLL. I would like to create some sample code that demonstrates my assembly in VB and would like to have two builds, one using my debug version and the other using the release version of the assembly. How can I do...
15
2683
by: arnuld | last post by:
-------- PROGRAMME ----------- /* Stroustrup, 5.6 Structures STATEMENT: this programmes *tries* to do do this in 3 parts: 1.) it creates a "struct", named "jd", of type "address". 2. it then adds values to "jd" 3.) in the end it prints values of "jd".
2
1854
by: Veloz | last post by:
Hiya My question is whether or not you should associated related objects in your software using a scheme of id's and lookups, or wether objects should actually hold actual object references to objects they are associated with. For example, lets say you are modelling studen ratings of teachers. Let's say your applications needs to analyze these ratings for teachers and is provided a data file. In this data file the teachers all have...
68
4652
by: Jim Langston | last post by:
I remember there was a thread a while back that was talking about using the return value of a function as a reference where I had thought the reference would become invalidated because it was a temporary but it was stated that it would not. This has come up in an irc channel but I can not find the original thread, nor can I get any code to work. Foo& Bar( int Val ) { return Foo( Val ); }
0
9628
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
10289
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
10120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7471
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
6722
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
5367
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3622
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2860
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.