views:

96

answers:

3
+7  A: 

The two are exactly identical once compiled. I find string.Empty is more readable. For all we know "" really should have something inside of it and it's just a typo.

Matt Greer
Also, it's harder to spot a typo like "'" when you really meant the empty string "".
Guffa
+1  A: 

Once the compiler gets done with that code, the IL/machine code for both fragments will be identical.

I tend to use string.Empty when an empty string is an important part of the algorithm. I tend to use "" for values that could be anything but for now it just happens to be an empty string. In other words, use the one that communicates the intent of the expression.

Jeffrey L Whitledge
+3  A: 

According to this MSDN blog post string.Empty is more efficient as it will not produce a new object.

Here are some more information, including a short performance comparison.

Anders Abel
Yeah but it is pre .NET 2.0: http://stackoverflow.com/questions/151472/what-is-the-difference-between-string-empty-and ;-)
MartyIX
The blog post is not correct. The string literal is created only once when the assembly is loaded (just like the string object for the String.Empty property), executing the code that uses the string literal doesn't create an object.
Guffa