- Feb 14, 2019
- Programming Experience
Indeed. WritingI would rather name the extension the same as the original though, since it is more accurate and I wouldn't have to think too much about what it actually means in different circumstances.
IsNotNullOrWhitespacemethods seems the better option. Using
HasValueprecludes an equivalent for
IsNullOrWhitespaceso you back yourself into a corner on that.
string str = null; bool x = str.Length > 0;
string str = null; bool x = str?.Length > 0;