That is the short form of a Nullable type. It's the same as:
private Nullable<shortunits;
It's a Nullable structure that contains a short value and a flag that
determines if the structure contains a valid value or not. The variable
can be assigned a null value:
units = null;
Or a short value:
units = 42;
The HasValue property determines if the structure contains a valid value:
if (units.HasValue) {
Console.Write(units.Value);
} else {
Console.Write("n/a");
}
Mr Flibble wrote:
I have this in some sample code
private short? units;
What does the '?' mean? I've only seen '?' as an operator.