开发者

Difference between "" and String.Empty() [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

开发者_如何学编程 What is the difference between String.Empty and “”

What is the difference between code and where it is applicable??

string mystr = "";

string mystr1 = String.Empty();


The answer appears to be 'nothing'.

However, good programming practice says that you should preferably use string.Empty, as if in the future an empty string were to be represented by something other than "", your code otherwise might break. (I can't see tha change happening, but in principle it might).


I think this will explain it for you: http://msdn.microsoft.com/en-us/library/system.string.empty.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜