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.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted @ Monday, July 24, 2006 8:54 AM
Print

Comments on this entry:

No comments posted yet.

Your comment:



(not displayed)


 
 
 
 
 

Live Comment Preview:

 
«February»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910