public static AnyQuantity <double> GetUnitizedQuantityOf <TQuantity>(double value) where TQuantity : BaseQuantity, new() { MetricUnit unit = UnitOf <TQuantity>(); AnyQuantity <double> aq = unit.GetThisUnitQuantity <double>(); aq.Value = value; return(aq); }
private static AnyQuantity <double> MakeQuantity(MetricUnit unit, MetricPrefix siPrefix, double value) { //assign its prefix unit.UnitPrefix = siPrefix; //create the corresponding quantity AnyQuantity <double> qty = unit.GetThisUnitQuantity <double>(); //assign the unit to the created quantity qty.Unit = unit; //assign the value to the quantity qty.Value = value; return(qty); }