Check out example codes for "conditonal statements c sharp online". It will help you in understanding the concepts better.

Code Example 1

//Default If condition
                if (comEnvList.Items.Count > 0)
                {
                    comEnvList.SelectedIndex = 1;
                }
                else
                {
                    comEnvList.SelectedIndex = 0;
                }
                //IIf statement
                comEnvList.SelectedIndex = comEnvList.Items.Count > 0 ? 1 : 0;

Code Example 2

int time = 22;
if (time < 10) 
{
  Console.WriteLine("Good morning.");
} 
else if (time < 20) 
{
  Console.WriteLine("Good day.");
} 
else 
{
  Console.WriteLine("Good evening.");
}

Code Example 3

var rand = new Random();
var condition = rand.NextDouble() > 0.5;

var x = condition ? 12 : (int?)null;

Learn ReactJs, React Native from akashmittal.com