Struct Ratio
- Namespace
 - UnitsNet
 
- Assembly
 - UnitsNet.Ratio.dll
 
In mathematics, a ratio is a relationship between two numbers of the same kind (e.g., objects, persons, students, spoonfuls, units of whatever identical dimension), usually expressed as "a to b" or a:b, sometimes expressed arithmetically as a dimensionless quotient of the two that explicitly indicates how many times the first number contains the second (not necessarily an integer).
public struct Ratio
  Constructors
Ratio(double, RatioUnit)
Creates the quantity with the given numeric value and unit.
public Ratio(double value, RatioUnit unit)
  Parameters
valuedoubleThe numeric value to construct this quantity with.
unitRatioUnitThe unit representation to construct this quantity with.
Exceptions
- ArgumentException
 If value is NaN or Infinity.
Properties
BaseUnit
The base unit of Ratio, which is Second. All conversions go via this value.
public static RatioUnit BaseUnit { get; }
  Property Value
DecimalFractions
Gets a double value of this quantity converted into DecimalFraction
public double DecimalFractions { get; }
  Property Value
MaxValue
Represents the largest possible value of Ratio.
public static Ratio MaxValue { get; }
  Property Value
MinValue
Represents the smallest possible value of Ratio.
public static Ratio MinValue { get; }
  Property Value
PartsPerBillion
Gets a double value of this quantity converted into PartPerBillion
public double PartsPerBillion { get; }
  Property Value
PartsPerMillion
Gets a double value of this quantity converted into PartPerMillion
public double PartsPerMillion { get; }
  Property Value
PartsPerThousand
Gets a double value of this quantity converted into PartPerThousand
public double PartsPerThousand { get; }
  Property Value
PartsPerTrillion
Gets a double value of this quantity converted into PartPerTrillion
public double PartsPerTrillion { get; }
  Property Value
Percent
public double Percent { get; }
  Property Value
Unit
public RatioUnit Unit { get; }
  Property Value
Value
The numeric value this quantity was constructed with.
public double Value { get; }
  Property Value
Zero
Gets an instance of this quantity with a value of 0 in the base unit Second.
public static Ratio Zero { get; }
  Property Value
Methods
As(RatioUnit)
Convert to the unit representation unit.
public double As(RatioUnit unit)
  Parameters
unitRatioUnit
Returns
- double
 Value converted to the specified unit.
From(double, RatioUnit)
public static Ratio From(double value, RatioUnit fromUnit)
  Parameters
Returns
- Ratio
 Ratio unit value.
FromDecimalFractions(double)
Creates a Ratio from DecimalFraction.
public static Ratio FromDecimalFractions(double decimalfractions)
  Parameters
decimalfractionsdouble
Returns
Exceptions
- ArgumentException
 If value is NaN or Infinity.
FromPartsPerBillion(double)
Creates a Ratio from PartPerBillion.
public static Ratio FromPartsPerBillion(double partsperbillion)
  Parameters
partsperbilliondouble
Returns
Exceptions
- ArgumentException
 If value is NaN or Infinity.
FromPartsPerMillion(double)
Creates a Ratio from PartPerMillion.
public static Ratio FromPartsPerMillion(double partspermillion)
  Parameters
partspermilliondouble
Returns
Exceptions
- ArgumentException
 If value is NaN or Infinity.
FromPartsPerThousand(double)
Creates a Ratio from PartPerThousand.
public static Ratio FromPartsPerThousand(double partsperthousand)
  Parameters
partsperthousanddouble
Returns
Exceptions
- ArgumentException
 If value is NaN or Infinity.
FromPartsPerTrillion(double)
Creates a Ratio from PartPerTrillion.
public static Ratio FromPartsPerTrillion(double partspertrillion)
  Parameters
partspertrilliondouble
Returns
Exceptions
- ArgumentException
 If value is NaN or Infinity.
FromPercent(double)
public static Ratio FromPercent(double percent)
  Parameters
percentdouble
Returns
Exceptions
- ArgumentException
 If value is NaN or Infinity.
ToUnit(RatioUnit)
Converts this Ratio to another Ratio with the unit representation unit.
public Ratio ToUnit(RatioUnit unit)
  Parameters
unitRatioUnit
Returns
- Ratio
 A Ratio with the specified unit.