This is specifically referring to some C# properties I want to rewrite.
Example of one of the original properties:
public double? PartQuantity
{
get
{
if( MaintenanceRequestPart != null )
return MaintenanceRequestPart.ReportedQuantity.HasValue
? (double?)MaintenanceRequestPart.ReportedQuantity.Value
: null;
return null;
}
}
What this will be changed to:
public double? PartQuantity => MaintenanceRequestPart?.ReportedQuantity;
note 1: MaintenanceRequestPart
can be null
note 2: MaintenanceRequestPart.ReportedQuantity
is a nullable double
Will this save or add some operations/branching/overhead? I'm curious as to what the ?. operator actually translates into behind the scenes once it's turned into intermediate language.