An Alternative to string.isnullorempty

Updating an old module originally designed for ASP.NET 2 the test IsNullOrEmpty gave the error IsNullOrEmpty.

The string test used was

If Not String.IsNullOrEmpty(filterString) Then
...
End if

And the error viewed was:

'IsNullOrEmpty' is not a member of 'String'

An alternative to this test is to test for nothing, together with a test to ensure that the string had a length.

In the example below filterString is the string to be tested.

If not filterString is nothing andalso filterString.Length > 0 then
...
End if