.NET Checking empty strings
By Indranil Chatterjee
This is an FAQ to test for empty strings, null references or strings with just whitespaces.
In our day to day coding, we often need to test strings if they have some value. Having
a value normally means that it shouldn't be empty, shouldn't be null and shouldn't
just comprise of whitespace characters (space, tab etc). With .NET
2.0, we could do String.IsNullOrEmpty, but that didn't check for whitespace.
.NET 4.0 adds String.IsNullOrWhiteSpace, which checks for all the three cases
mentioned above.
.NET Checking empty strings (614 Views)