-----------------------------------------------------------

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: Vinil
Message 5 in Discussion

Hi Denis,
Unlike VB6, VB.NET by default "does" Short circuit evaluations. BUT in some situations 
you have to help the compiler generate the appropriate code.
Looking at your statement, at compile time VB.NET doesn' t know how to order your 
function calls, and hence leaves out the Short ckt evaluation (the operand order in an 
OR comparison doesn't matter, hence the compiler is unable to take a guess as to which 
function to evaluate first, hence the confusion. Whereas such a problem doesnt exist 
with OrElse because you are specifying the first function to execute (the LHS side 
one))
Assigning the result of fn 1 to a temp var and then using that var in the Or check 
should solve this problem.

a = fn1()
if a or fn2() then
pqr
end if

Hope that clears the confusion :)
Regards,
Vinil


-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to