diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs index 07d0c250a0..611d440ff9 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -20,6 +20,7 @@ // THE SOFTWARE. using System; +using JetBrains.Annotations; namespace UnitsNet { @@ -46,6 +47,7 @@ BaseDimensions Dimensions } #if !WINDOWS_UWP + public interface IQuantity : IQuantity where UnitType : Enum { /// @@ -60,6 +62,42 @@ public interface IQuantity : IQuantity where UnitType : Enum /// Unit representation to use. /// String representation. string ToString(UnitType unit); + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// Unit representation to use. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + string ToString(UnitType unit, [CanBeNull] IFormatProvider provider); + + /// + /// Get string representation of value and unit. + /// + /// Unit representation to use. + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + string ToString(UnitType unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix); + + /// + /// Get string representation of value and unit. + /// + /// Unit representation to use. + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + string ToString(UnitType unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args); + + /// + /// The unit this quantity was constructed with or the BaseUnit if the default constructor was used. + /// + UnitType Unit + { + get; + } } + #endif }