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?
@Jay is correct, they are not the same. String.IsNullOrEmpty()
is a convenient method to check for both null and "".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With