I told you I would blog about this soon!!
reasons why I moved away from VB.Net, let me count the ways... IIF is evil. Pure evil. check out the MSDN on IIF.
There is a small note in the remarks:
Note The expressions in the argument list can include function calls. As part of preparing the argument list for the call to IIf, the Visual Basic compiler calls every function in every expression. This means that you cannot rely on a particular function not being called if the other argument is selected by Expression.
So if you decide to write some code reading in anything that may compile wrong like:
x as int
iif(isnull(x), 0, x= x + 1)
This will blow up. Just looking at it, this code should run fine, but check that note out and you will see that x is null.
-Jay
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5