Joan Venge Joan Venge - 1 month ago 10
C# Question

What is the difference between String.Empty and “” and null?


Possible Duplicate:

What is the difference between String.Empty and “”


Is
""
equivalent to
String.Empty
?

Which is preferred for initializing string values?

Answer
public sealed class String {
    //...
    public static readonly String Empty = "";
    //...
}

Use null when you want to represent that there is no value;

Use String.Empty when you want to represent that there is a value, but the value is a blank string.