Blog Pages

VB.Net Logical Operators: AndAlso and OrElse

If (Not myObj Is Nothing) And (myObj.PropertyValue = "1") Then – Here we will FAIL when myObj is Nothing
If (Not myObj Is Nothing) AndAlso (myObj.PropertyValue = "1") Then – Here we will not get to the second condition when myObj is Nothing
Same logic apply for Or and OrElse

No comments:

Post a Comment