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.
string.IsNull(); and string.IsEmpty(); separate methods does not exist. string.IsNullOrEmpty() exists?string.IsNull doesn't exist because you'd just check for the reference being nullstring.IsEmpty doesn't exist because you can easily compare for equality with "" or for a length of 0string.IsNullOrEmpty exists because it's simpler to write the single method call than use
if (text == null || text.Length == 0)
(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.
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