How To Call C# If Else In A Single Line

Here is the syntax of using C# if else statement in a single line. 
  1. (Condition) ? "Value For true":" Value For False "  
OK, here is your typical if else statement: 
  1. if(x==1)  
  2. {  
  3. x=10;  
  4. }  
  5. else  
  6. {  
  7. x=15;  
  8. }  
This is how we can replace the above code block in a single line: 
  1. x=(x==1)?10:15;  
Here is a detailed tutorial, How To Use C# If Else Statement