VB.NET: Empty string vs. Null Reference
‘If st is an empty string, e.g.:
Dim st as String = String.Empty
‘The following returns TRUE:
Dim ok as Boolean = (st = Nothing)
‘But this returns FALSE:
Dim ok as Boolean = (st is Nothing)
The “=” operator for String data type in VB.NET treats empty strings and null strings equally whereas the “is” operator treats strings as reference and does not care about the values. An empty string is not a null reference.