In .NET, what is the difference between String.Empty
and \"\"
, and are they interchangable, or is there some underlying reference or Localization i
I tend to use String.Empty
rather than ""
for one simple, yet not obvious reason:
""
and ""
are NOT the same, the first one actually has 16 zero width characters in it. Obviously no competent developer is going to put and zero width characters into their code, but if they do get in there, it can be a maintenance nightmare.
Notes:
I used U+FEFF in this example.
Not sure if SO is going to eat those characters, but try it yourself with one of the many zero-width characters
I only came upon this thanks to https://codegolf.stackexchange.com/