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)


 
 
 
Please add 3 and 1 and type the answer here:
 

Live Comment Preview:

 
«December»
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910