Class UnitFactory
- Namespace
- Codebelt.Unitify
- Assembly
- Codebelt.Unitify.dll
Provides a set of static methods for generating different types of unit of measure and the option to define your own with CreateUnit(String, String, String, Double, IPrefix, Action<UnitFormatOptions>).
public static class UnitFactory
- Inheritance
-
ObjectUnitFactory
Methods
CreateAmpere(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Electric Current in amperes.
public static IPrefixUnit CreateAmpere(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Electric Current in amperes.
- See Also
CreateBecquerel(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Radioactivity in becquerels.
public static IPrefixUnit CreateBecquerel(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Radioactivity in becquerels.
- See Also
CreateBit(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Data Quantity in bits.
public static IPrefixUnit CreateBit(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe optional prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Data Quantity in bits.
- See Also
CreateBitPerSecond(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Transmission Rate in bits per second.
public static IPrefixUnit CreateBitPerSecond(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Transmission Rate in bits per second.
- See Also
CreateByte(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Data Quantity in bytes.
public static IPrefixUnit CreateByte(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe optional prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Data Quantity in bytes.
- See Also
CreateCandela(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Luminous Intensity in candelas.
public static IPrefixUnit CreateCandela(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Luminous Intensity in candelas.
- See Also
CreateCelsius(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Temperature in degrees Celsius.
public static IPrefixUnit CreateCelsius(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Temperature in degrees Celsius.
- See Also
CreateCoulomb(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Electric Charge in coulombs.
public static IPrefixUnit CreateCoulomb(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Electric Charge in coulombs.
- See Also
CreateFarad(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Electric Capacitance in farads.
public static IPrefixUnit CreateFarad(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Electric Capacitance in farads.
- See Also
CreateGram(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Mass in grams.
public static IPrefixUnit CreateGram(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Mass in grams.
- See Also
CreateGray(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Absorbed Dose in grays.
public static IPrefixUnit CreateGray(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Absorbed Dose in grays.
- See Also
CreateHenry(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Inductance in henries.
public static IPrefixUnit CreateHenry(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Inductance in henries.
- See Also
CreateHertz(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Frequency in hertz.
public static IPrefixUnit CreateHertz(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Frequency in hertz.
- See Also
CreateJoule(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Energy in joules.
public static IPrefixUnit CreateJoule(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Energy in joules.
- See Also
CreateKatal(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Catalytic Activity in katals.
public static IPrefixUnit CreateKatal(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Catalytic Activity in katals.
- See Also
CreateKelvin(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Temperature in kelvin.
public static IPrefixUnit CreateKelvin(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Temperature in kelvin.
- See Also
CreateKilogram(Double, Action<UnitFormatOptions>)
Creates a unit of measure for Mass in kilograms.
public static IPrefixUnit CreateKilogram(double value, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Mass in kilograms.
- See Also
CreateLumen(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Luminous Flux in lumens.
public static IPrefixUnit CreateLumen(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Luminous Flux in lumens.
- See Also
CreateLux(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Illuminance in lux.
public static IPrefixUnit CreateLux(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Illuminance in lux.
- See Also
CreateMeter(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Length in meters.
public static IPrefixUnit CreateMeter(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Length in meters.
- See Also
CreateMole(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Amount of Substance in moles.
public static IPrefixUnit CreateMole(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Amount of Substance in moles.
- See Also
CreateNewton(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Force in newtons.
public static IPrefixUnit CreateNewton(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Force in newtons.
- See Also
CreateOhm(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Electric Resistance in ohms.
public static IPrefixUnit CreateOhm(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Electric Resistance in ohms.
- See Also
CreatePascal(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Pressure in pascals.
public static IPrefixUnit CreatePascal(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Pressure in pascals.
- See Also
CreateRadian(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Plane Angle in radians.
public static IPrefixUnit CreateRadian(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Plane Angle in radians.
- See Also
CreateSecond(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Time in seconds.
public static IPrefixUnit CreateSecond(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Time in seconds.
- See Also
CreateSiemens(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Electric Conductance in siemens.
public static IPrefixUnit CreateSiemens(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Electric Conductance in siemens.
- See Also
CreateSievert(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Equivalent Dose in sieverts.
public static IPrefixUnit CreateSievert(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Equivalent Dose in sieverts.
- See Also
CreateSteradian(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Solid Angle in steradians.
public static IPrefixUnit CreateSteradian(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Solid Angle in steradians.
- See Also
CreateTesla(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Magnetic Flux Density in teslas.
public static IPrefixUnit CreateTesla(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Magnetic Flux Density in teslas.
- See Also
CreateUnit(String, String, String, Double, IPrefix, Action<UnitFormatOptions>)
Creates a custom unit of measure.
public static IPrefixUnit CreateUnit(string category, string name, string symbol, double value, IPrefix prefix, Action<UnitFormatOptions> setup = null)
Parameters
category
StringThe category of the unit.
name
StringThe name of the unit.
symbol
StringThe symbol of the unit.
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A custom unit of measure.
CreateVolt(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Electric Potential in volts.
public static IPrefixUnit CreateVolt(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Electric Potential in volts.
- See Also
CreateWatt(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Power in watts.
public static IPrefixUnit CreateWatt(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Power in watts.
- See Also
CreateWeber(Double, IPrefix, Action<UnitFormatOptions>)
Creates a unit of measure for Magnetic Flux in webers.
public static IPrefixUnit CreateWeber(double value, IPrefix prefix = null, Action<UnitFormatOptions> setup = null)
Parameters
value
DoubleThe value of the unit.
prefix
IPrefixThe prefix of the unit.
setup
Action<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- IPrefixUnit
A unit of measure for Magnetic Flux in webers.
- See Also