AndAlso operator is Visual Basic (VB) is used to short-circuit the evaluation in the if condition. The regular AND operator does not short-circuit the evaluation of the second logical condition if the first condition evaluates to a Boolean false.
I believe, OrElse and AndAlso should always be used in VB instead of regular Or and And we are familiar with. This should improve the performance especially the second logical condition requires a function call or database access to evaluate.
- There is no "real" differnce between OrElse and Or in the VB. Both produces the same result when used in place of each other. The OrElse operator should perform better than Or operator.
- There is no "real" difference between AndAlso and And in the VB. Both produces the same result when used in place of each other. The AndAlso operator should perform better than the regular And operator.