473,503 Members | 7,578 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

difference between "" and String.Empty

Hi All,

Was just courious is there any performance/managebility issue while using ""
or String.Empty.

for example

Dim str As String = String.Empty '// first
Dim str As String = "" '// second
i.e. which one will run faster?

Thanks in advance
F
Feb 14 '07 #1
2 2809
"Rohn Farrington" <ro*@w.d.microsoft.comwrote in message
news:eV**************@TK2MSFTNGP03.phx.gbl...
Was just courious is there any performance/managebility issue while using
"" or String.Empty.
http://www.microsoft.com:80/communit...4-63cd93fffd10
Feb 14 '07 #2
"Rohn Farrington" <ro*@w.d.microsoft.comwrote in message
news:eV**************@TK2MSFTNGP03.phx.gbl...
Hi All,

Was just courious is there any performance/managebility issue while using
"" or String.Empty.

for example

Dim str As String = String.Empty '// first
Dim str As String = "" '// second
Dim str As String ' Will run even faster!

You don't need to initialize every variable when it is declared (and you
don't need to declare all of your variables at the beginning of your
methods). Just make sure each is initialized before use.

John
Feb 14 '07 #3

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

Similar topics

3
9559
by: Paul T. Rong | last post by:
Do "" and Null both mean nothing?¡¡ If I don't type anything in text box, the its value is Null£¿¡¡Or it is ¡°¡±£¿ I don¡¯ think they are the same, but I don¡¯t know their difference. Thanks.
3
17627
by: Fei Li | last post by:
Hi, take string class as an example, who can explain the difference? Thanks
6
5472
by: Ole Hanson | last post by:
Hi I am wondering if there is any programmatic difference between the String.Empty and the "" for declaring an empty string? Furthermore, is there any performance penalty by doing the one over...
8
5888
by: David Cameron | last post by:
I noticed that using an HTMLInputRadioButton and specifying a value to be an empty string (""), this is overridden by ASP.Net which set the value of the control to be the same as the ID of the...
8
4825
by: Peter Merwood | last post by:
I'm using some sample code from MSDN. The code includes the following statement: Dim content as = .Empty I'm not familiar with the use of the square brackets. Can someone please explain to...
6
71932
by: John Pass | last post by:
What is the difference between a While and Do While/Loop repetition structure. If they is no difference (as it seems) why do both exist?
6
13722
by: Charlie | last post by:
Hi: Is there any difference between string.Empty and String.Empty? And what is the benefit of using it over "". Thanks, Charlie
61
3082
by: academic | last post by:
When I declare a reference variable I initialize it to Nothing. Now I'm wondering if that best for String variables - is "" better? With Nothing I assume no memory is set aside nor GC'ed But...
26
2734
by: anonieko | last post by:
In the past I always used "" everywhere for empty string in my code without a problem. Now, do you think I should use String.Empty instead of "" (at all times) ? Let me know your thoughts.
21
2916
by: Sami | last post by:
string = "" or string = string.Empty? should is the proper way? Sami
0
7194
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
7070
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
7267
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,...
1
6976
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...
0
7449
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...
0
5566
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
3160
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...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
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...

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.