Thursday, April 4, 2013

Ternary operator in VB.Net

Recently in one of the project I was working with VB.NET language and I was eager to know if there is a ternary operator equivalent there or not. After searching on internet I have found two ways to do it.
We have two operators in vb.net to accomplish this task
1) if(condition,true,false)
2) iif(condition,true,false) You can see that both IIF and If operator has three parameter first parameter is the condition which you need to check and then another parameter is true part of you need to put thing which you need as output when condition is ‘true’.
We can use any of the two operators and get same output.

No comments :

Post a Comment