One line if in VB .NET
问题 Is it possible to do one line if statement in VB .NET? If so, how? 回答1: Use IF(). It is a short-circuiting ternary operator. Dim Result = IF(expression,<true return>,<false return>) SEE ALSO: IIF becomes If, and a true ternary operator Is there a conditional ternary operator in VB.NET? Orcas introduces the IF operator - a new and improved IIF The Ternary Operator in VB.NET 回答2: It's actually pretty simple.. If CONDITION Then ..INSERT CODE HERE.. 回答3: At the risk of causing some cringing by