In VB.NET, the IIF function is 300% slower than the if...else...end if clause (according to VB.NET in a Nutshell).
This information is wrong, or incomplete.
IIF is implemented as a function, and as such, evals both the true and the false part and returns only the true part.
It's easy to see if you run this code:
public module MyModule
function VerySlowFunc(ByVal i as integer) as integer
System.Threading.Thread.Sleep(10 * 1000)
Console.WriteLine("Veryslow called with parameter " + CStr(i))
return i * 2
Console.WriteLine(IIF(true, VerySlowFunc(1), VerySlowFunc(2)))
This takes 20 seconds to run and print 2 messages, because VB will evaluate both the true and the false part. Change it for an if and the code will take only 10 seconds to run and print only 1 message.
Answering the question: the :? operator on C# is as fast as an if, and does not have the VB.NET behavior.
Due to technical difficulties my previous signature, "I see dumb people" will be off until further notice. Too many people were thinking I was talking about them...