Skip to main content

Class UnitFactory

Factory methods for unit creation

Assembly: Meadow.Units.dll
View Source
Declaration
public class UnitFactory

Methods

CreateUnitFromCanonicalValue(double, string)

Method to create a unit from its canonical value.

View Source
Declaration
public static object CreateUnitFromCanonicalValue(double value, string unitTypeName)
Returns

System.Object

Parameters
TypeNameDescription
System.DoublevalueThe canonical value to use for creation
System.StringunitTypeNameThe name of the Unit to be created

FromCelsius(double)

Creates a Temperature unit from a Celsius value

View Source
Declaration
public static Temperature FromCelsius(double celsius)
Returns

Meadow.Units.Temperature

Parameters
TypeName
System.Doublecelsius

FromVolts(double)

Creates a Voltage unit from a Volts value

View Source
Declaration
public static Voltage FromVolts(double volts)
Returns

Meadow.Units.Voltage

Parameters
TypeName
System.Doublevolts

FromMeters(double)

Creates a Length unit from a Meters value

View Source
Declaration
public static Length FromMeters(double meters)
Returns

Meadow.Units.Length

Parameters
TypeName
System.Doublemeters