0

Possible Duplicate:
What is the difference between String.Empty and “”

Why it is recommended to use string.Empty instead of ""? From one side, I understand, that it makes code clearer, without "Magic constants". Is there any another technical benefits of using string.Empty?
Thanks.

1

2 Answers 2

4

Per Brad Abrams blog:

the difference between String.Empty and “” are pretty small, but there is a difference. “” actually creates an object, it will likely be pulled out of the string intern pool, but still… while String.Empty creates no object… so if you are really looking for ultimately in memory efficiency, I suggest String.Empty. However, you should keep in mind the difference is so trival you will like never see it in your code…

It's pretty insignificant.

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

Comments

3

I believe this has been answered before, but to summarize: preference and readability.

They are completely equivalent, and are up to whatever you and your fellow developers prefer, just be consistent. :)

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.