Say you have a property like this:
private int? _startOdometer;
public int? StartOdometer
{
get
{
if (_startOdometer.HasValue) { return _startOdometer.Value; }
return null;
}
set
{
_startOdometer = value;
}
}
When you try to do the following what will the value of _startOdometer be?
myObject.StartOdometer += myIntegerValue;
ANSWER: NULL
In order to do this kind of operator on a nullable int (or any other nullable value), you have to do:
myObject.StartOdometer = myObject.GetDefaultValueOrValue() + myIntegerValue;
AHA!