Depends upon the version. The If
operator in VB.NET 2008 is a ternary operator (as well as a null coalescence operator). This was just introduced, prior to 2008 this was not available. Here's some more info: Visual Basic If announcement
Example:
Dim foo as String = If(bar = buz, cat, dog)
[EDIT]
Prior to 2008 it was IIf
, which worked almost identically to the If
operator described Above.
Example:
Dim foo as String = IIf(bar = buz, cat, dog)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…