In Visual Basic I'd write this: If stringVariable IsNot Nothing then Dim x as Integer x = stringVariable.Length End If I test the string for null/nothing because if I try to get the Length of a ...
.NET Framework 4 introduces a new method on its String class called IsNullOrWhiteSpace that checks whether a provided String is null, empty, or consists only of “white space.” This handy method is in ...