Typically the main use of the question mark is for the conditional, x ? "yes" : "no"
.
But I have seen another use for it but can't find an explanation of this use of the ?
operator, for example.
public int? myProperty
{
get;
set;
}
Typically the main use of the question mark is for the conditional, x ? "yes" : "no"
.
But I have seen another use for it but can't find an explanation of this use of the ?
operator, for example.
public int? myProperty
{
get;
set;
}
It means that the value type in question is a nullable type
In
the ? declares an if sentence. Here: x represents the boolean condition; The part before the : is the then sentence and the part after is the else sentence.
In, for example,
the ? declares a nullable type, and means that the type before it may have a null value.