This blog defines the Ternary operator in VB.NET.
Ternary operator
The general syntax of the Ternary operator in VB.NET.
If(question, expression1, expression2)
Here question(?) is the condition if condition is true, then expression1 will be execute otherwise expression2 will be execute.
The general syntax of the Ternary operator in C#.NET.
question ? expression1 : expression2
It can be rewritten the above Syntax :
if (question =true){
expression1;
}else {
expression2;
}
For example
C# code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication42
{
class Program
{

Join the conversation! Your thoughts help the community grow.