Possible Duplicate:
In C#, should I use string.Empty or String.Empty or “”?
What is the difference between:
return string.Empty;
return String.Empty;
return "";
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since
stringis a language alias forString, there is absolutely no difference between the first and the second expressions.Starting with .NET 2,
""returns exactly the same object asString.Empty, making all three statements exact equivalents of each other in terms of the value that they return. Even in .NET prior to 2 no multiple objects would be created due to interning.The first and second snippets will produce IL code that is different from the third snippet, but they all would return the same object.