473,388 Members | 1,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Perf difference between importing a namespace and wrting the fully qualified name in code?

BH
Is there a performance difference between importing (keyword "using") a
namespace for an entire class file and using the classes from that namespace
with the fully qualified name? Particularly when only one class from the
namespace is needed once? For example:

Option 1:
.....
using System.Text;
......
StringBuilder sb = new StringBuilder();

Option 2:
.......
System.Text.StringBuilder sb = new System.Text.StringBuilder();
Thanks
Bob
Nov 15 '05 #1
1 1995
On Sun, 27 Jul 2003 10:40:42 -0500, "BH" <bo*******@yahoo.com> wrote:
Is there a performance difference between importing (keyword "using") a
namespace for an entire class file and using the classes from that namespace
with the fully qualified name? Particularly when only one class from the
namespace is needed once? For example:

Option 1:
....
using System.Text;
.....
StringBuilder sb = new StringBuilder();

Option 2:
......
System.Text.StringBuilder sb = new System.Text.StringBuilder();
Thanks
Bob


They are the exact same. The C# compiler compiles both to

instance void [mscorlib]System.Text.StringBuilder::.ctor()

in the Intermediate Language.

Austin Ehlers
Nov 15 '05 #2

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

Similar topics

0
by: Mark English | last post by:
Basic problem: If there is a C-extension module in a package and it tries to import another python module in the same package without using the fully qualified path, the import fails. Config:...
2
by: puzzlecracker | last post by:
after reading some of the post I found out something rather radical to my previous understanding: that when you do #include<iostream> #include<string> #include<vector> etc compiler puts...
5
by: dixie | last post by:
If I sent a user an empty database container - dB with no tables and I needed them to import their tables into it and one of their tables was a hidden table with the prefix Usys, is there any way...
2
by: Jeff S | last post by:
I have the following three lines at the very top of a class file (prior to the namespace declaration line). using System; using System.Data; using System.Data.SqlClient; Then, in a...
11
by: Pohihihi | last post by:
I was wondering what is the ill effect of using try catch in the code, both nested and simple big one. e.g. try { \\ whole app code goes here } catch (Exception ee) {}
4
by: Jeff Jarrell | last post by:
I am not really there yet with namespaces. I have a "common.dll" that is referenced from another project. now in the consuming project, source file to i'd like to have a "imports common". ...
4
by: David A | last post by:
I'm trying to "isolate" some unmanaged calls to DLLs in a separate namespace so I can have all the unmanaged calls to DLL functions in a separate module and then these can be called from any other...
12
by: Keith Patrick | last post by:
Can someone tell me the difference in terms of actual implications using: namespace MyNamespace { using System; class MyClass {...} } vs. using System;
7
by: Bart_D | last post by:
Hi, Can anybody explain me what's the difference between for example: imports system.data implements ICallbackEventHandler inherits System.Web.UI.Page Thanks Bart
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
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,...
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
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...

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.