CSharp examples for Language Basics:Operator
The conditional operator has the form q ? a : b, where if condition q is true, a is evaluated, else b is evaluated. For example:
using System;/*from ww w . j a v a2s .c o m*/ class Test { static int Max (int a, int b) { return (a > b) ? a : b; } static void Main(){ Console.WriteLine(Max(2,1)); } }