Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

34
  • 85
    Your eyes can trick you when you are expecting to see "" you can easily mistake " " for "". This is why it is easier to edit something that someone else has written. Your brain doesn't have preconceived ideas about the text so it is easier to pick out the anonmalies. Commented Nov 4, 2008 at 20:18
  • 148
    @tvanfosson: So have you (or a colleague) actually been bitten by this as a bug? I'm suspicious of this sort of claim without it actually having caused problems. I've been using "" for years without ever getting it wrong... Commented Nov 4, 2008 at 20:27
  • 35
    Personally, I've always used String.Empty, I use capital 'S' whenever I want to use a static method on string, it's just a personal prefference that allows me to distinguish a type from a variable. But this is just a carry-over from using StringUtils.EMPTY in commons.lang from java. One point of interest is I'm almost blind and this definately does help with readability for me. Commented Sep 11, 2009 at 4:34
  • 89
    You have given me the inspiration to start developing in Times New Roman. Commented Feb 21, 2010 at 18:39
  • 94
    For some obscure reason string.Empty is not a constant. That means that in a number of cases where a compile-time constant is required, string.Empty isn't even legal. This includes case "" blocks in switch statements, default values of optional parameters, parameters and properties in applying attributes, and a lot of other situations (left to the reader). So given that string.Empty is disallowed in some common situations, it is better to use the ""-everywhere convention. Commented May 10, 2013 at 21:20