Quick question, of which the quickest and easiest answer may well be to rearrange related code, but let's see...
So I have an If
statement (a piece of code which is a part of a full working solution written in C#) rewritten using VB.NET. I am aware the VB.NET IIf(a, b, c)
method evaluates both b
and a
regardless of the trueness of the first evaluation, but this seems to be the case in my standard construct, too:
If (example Is Nothing Or example.Item IsNot compare.Item) Then
'Proceed
End If
Or, rather, more appropriately:
If (example Is Nothing Or Not example.Item = compare.Item) Then
'Proceed
End If
Here, if example
is Nothing
(null
) then I still get an NullReferenceException
- is this my fault, or is it something I just have to endure at the whim of VB.NET?