Reputation: 241
Is there a way to use string.Equals or string.Compare in way that two nulls or two empty strings return false or a number other than 0 respectively?
Use Case:
string.Equals(null, null) = false;
string.Equals("", string.empty) = false;
string.Compare(null, null) != 0;
string.Compare("", string.empty) != 0;
Upvotes: 0
Views: 243
Reputation: 558
You can try doing a not before like:
!string.Equals(null, null)
Upvotes: 1