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?

2
  • 2
    Duplicate of stackoverflow.com/questions/263191/… Commented Sep 16, 2010 at 9:23
  • 1
    -1 A quick search will reveal multiple duplicate questions on SO for the exact same topic Commented Sep 16, 2010 at 9:28

2 Answers 2

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 ""

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.