The difference is the same as writing the question with empty text (I hope this is prevented by CodeProject software though) and not posting any question at all. Note that the second option would be much better: you could easily learn this matter by reading original documentation.
Note that the question is inconsistent (please see my comment to the question and other answers).
The problem with null is trivial, but
""
vs.
String.Empty
is not so simple. First would work like
immediate constant and the second one is the read-only field. They make the same result, but due to a very non-trivial feature of strings, specifically:
string interning. Please see:
http://en.wikipedia.org/wiki/String_interning[
^],
http://broadcast.oreilly.com/2010/08/understanding-c-stringintern-m.html[
^].
In not
intern pool, we could possibly end up having multiple "" strings in different parts of code. With intern pool, it doesn't happen.
Practically, it's important to use
String.Empty
, not an immediate constant. Immediate constants make code dirty, are bad for maintenance. Exclusions could be made for immediate constants like 0, 1 and null, but never "". Imaging you want to remove all hard-coded strings from the code, using text search. Would be a good idea. And then "" will get in your search result, so it's better to get rid of them in the very beginning.
—SA