If string.Empty != null why string.IsNullOrEmpty() is created?
I just want to say that:
if null and string.Empty are different to each other.
- why
string.IsNull();andstring.IsEmpty();separate methods does not exist. - why a combined method
string.IsNullOrEmpty()exists?
string.IsNulldoesn’t exist because you’d just check for the reference being nullstring.IsEmptydoesn’t exist because you can easily compare for equality with “” or for a length of 0string.IsNullOrEmptyexists because it’s simpler to write the single method call than use(or the inverse, of course).
Each of the individual checks can be done simply on its own, but it’s convenient to have a combination of the two.