2

Possible Duplicate:
In C#, should I use string.Empty or String.Empty or “” ?

I just don't understand the benefits of using String.Empty over "". Aside it being strongly typed its longer.

So please, why should I be using this?

Community
  • 1
  • 1
m.edmondson
  • 30,382
  • 27
  • 123
  • 206
  • 2
    Duplicate of http://stackoverflow.com/questions/263191/in-c-should-i-use-string-empty-or-string-empty-or – onof Sep 16 '10 at 09:23
  • 1
    -1 A quick search will reveal multiple duplicate questions on SO for the exact same topic – Jagmag Sep 16 '10 at 09:28

2 Answers2

7

As has been mentioned string.Empty creates no object where as "" will create an object (albeit pulled out of the pool). The performance difference is minimal but the question should be what is more readable. I take the stance that string.Empty sticks out more than "" and I can clearly see the intent of the declaration (string.Empty vs null). Regardless of your choice you should be consistent throughout your code base.

String.Empty vs ""

Bronumski
  • 14,009
  • 6
  • 49
  • 77