VB.Net compiler error when compare with Nothing.

I've got a compiler error

 Compiler Error Message: BC30452: Operator '<>' is not defined for types 'BaseResultItemsListUsc' and 'BaseResultItemsListUsc'.

If listResults <> Nothing Then
End If

Of course, the correct code should be
If listResults isNot Nothing Then
or
If Not (listResults is Nothing) Then
or
If Not IsNothing(listResults) Then

I made a search that there are a few other places where the <> Nothing  was used e.g.

If Request.QueryString("Field") <> Nothing then

dim r as DataRow
If r(x) <> "" And r(x) <> Nothing Then

It seems that compiler doesn't report “ <> Nothing“ for Object type, but reports errors for strong typed varables.

posted @ Monday, July 24, 2006 8:54 AM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345