/// Find the prefix with the specified scaling factor /// /// <param name="factor">Scaling factor</param> /// <returns> Prefix </returns> public static Prefix FromFactor(double factor) { Prefix prefix = null; foreach (Prefix p in prefixes) { if (p.Factor.CompareTo(factor) == 0) { prefix = p; break; } } return(prefix); }
/// <summary>Find the prefix with the specified name</summary> /// /// <param name="name"> Name of prefix</param> /// <returns> Prefix </returns> public static Prefix FromName(string name) { Prefix prefix = null; foreach (Prefix p in prefixes) { if (p.Name.Equals(name)) { prefix = p; break; } } return(prefix); }
/// <summary>Create a quantity with an amount, prefix and unit</summary> /// /// <param name="amount">Amount</param> /// <param name="prefix">Prefix</param> /// <param name="unit">Unit</param> /// public Quantity(double amount, Prefix prefix, Unit unit) : this(amount, MeasurementSystem.GetSystem().GetUOM(prefix, unit)) { }
/// <summary>Convert this quantity to the target unit with the specified prefix</summary> /// /// <param name="prefix">Prefix</param> /// <param name="unit">Unit</param> /// /// <returns>Quantity</returns> /// public Quantity Convert(Prefix prefix, Unit unit) { return(Convert(MeasurementSystem.GetSystem().GetUOM(prefix, unit))); }