Yes - another rant about VB. I really do dislike it the more I use it and I've been using it for too long! This time it's
IIf that's getting on my wick!
Why can't VB have the "normal" inline If like real programming languages
x = (a == b ? 1 : 2) and not this stupid
IIf function?
The problem I have (and I'm sure everybody else who VBs has), is that IIf is a function and therefore evaluates it's parameters first. Which then means this:
x = IIf(String.IsNullOrEmpty(textbox.Text), Nothing, Double.Parse(textbox.Text))
fails and has to be changed to this:
x = Nothing
If Not String.IsNullOrEmpty(textbox.Text) Then
x = Double.Parse(textbox.Text)
End If
OK, I know I can change it round a bit to make fit one line a bit more, but that's not the point. Come on MS, give us a real inline if...
Grrr!!