Point Deep

Mundeep's Tech Blog

Posts Tagged ‘csharp’

c# if else alternative syntax using ? : operator

Posted by mundeep on July 15, 2011

One of the c# operators i tend to use a lot is the ?: operator which is essentially an alternative syntax to an if else statement. Unfortunately i often forget the order of the statements so am adding this quick post as a note for myself to easily remember 🙂


condition ? first_expression : second_expression;

Is equivalent to:

if (condition) {
else {


Posted in .NET | Tagged: , , | 2 Comments »