Its called tenrary conditional operator. Have a look here MSDN.
I think there is no general rule or something. So you have to choose when to use which synthax.
I for myself just look which is easier to read for someone else looking at my source.
For simple assignments I often use the tenrary conditional operator:
var moneyToPay = (person.Age > 12) ? 15 : 8;
If the result is only a bool value, you don't need the operator, because the condition itself is a bool.
bool isOldPerson = (person.Age > 45);
If there is only like one function which i want to call depending on the condition, sometimes i do this:
var moneyToPay = (person.Age > 45)
? GetSomeValue()
: GetSomeOtherValue();
But this can get pretty messi really fast. If you want to do some extra work depending on the condition, you should use a normal if-statement like this:
if (person.Age > 45)
{
//Do stuff...
}
else
{
//Do stuff...
}
Just try to look at your code in the perspective of another developer. Is it really more easy to read with the tenrary conditional operator?