This might sound like a noob question, but are:
string var; if (var == null)
and
string var; if (var == string.Empty)
The same?
Duplicate
What’s the Difference between String.Empty and Null? and In C#, should I use String.Empty or Null?
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.
@Jay is correct, they are not the same.
String.IsNullOrEmpty()is a convenient method to check for both null and ”.