VB.NET - IIF(,,) - Both “sides” are evaluated. What situations should I watch out for?

后端 未结 5 894
天涯浪人
天涯浪人 2020-11-29 07:17

I recently learned of the IIF(A,B,C) function. I\'m a long time VB/VB.NET Coder who recently spent a lot of time coming up to speed in SQL coding.

One (obvious) commo

5条回答
  •  青春惊慌失措
    2020-11-29 07:45

    According to MSDN, the "If" operator introduced in VB2008 will short-circuit instead, which would be ideal for your expensive computation case:

    http://msdn.microsoft.com/en-us/library/bb513985.aspx

提交回复
热议问题