IIf Function in VB.NET
IIF returns one of two objects, depending on the evaluation of an expression.
IIf(Expression As Boolean,TruePart As Object,FalsePart As Object) As Object
IIF is a function and it only specific to VB.NET, because in C# there is no IIF, so it is not the part Common Language Runtime. IIf is an alternative to the If...Then...Else statement in VB.NET
Consider the following example :
If 10 > 9 Then MsgBox("True") Else MsgBox("False") End If
is same as
MsgBox(IIf(10 > 9, "True", "False"))
Both statements returns True.
Note :The expressions in the argument list can include function calls.