|
-
May 6th, 2007, 07:33 PM
#13
Re: [2005] The Conditional Operator - what's the VB.NET equivalent?
Another serious problem with IIf is that the result is 'Object', which can cause many problems that aren't caused by a true (ternary) conditional operator.
e.g.,
Dim str As String = Nothing
Dim len As Integer = IIf(str Is Nothing, "d", 0)
This will compile in VB, but fail at run-time. A true ternary conditional operator would cause a compiler error in this situation.
A true ternary operator is in the works for VB9. See the following link:
http://www.panopticoncentral.net/arc...x?Pending=true
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|