• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class DoubleUnit

Double value and its unit.

Inheritance
object
DoubleUnit
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public class DoubleUnit

Constructors

DoubleUnit(double, ScreenMeasurementUnit)

Initializes a new instance of the DoubleUnit class with a numeric value and its measurement unit.

Declaration
public DoubleUnit(double value, ScreenMeasurementUnit unit)
Parameters
Type Name Description
double value

The numeric measurement value.

ScreenMeasurementUnit unit

The unit in which value is expressed.

Properties

this[ScreenMeasurementUnit]

Gets the numeric value converted to the specified measurement unit.

Declaration
public double this[ScreenMeasurementUnit unit] { get; }
Parameters
Type Name Description
ScreenMeasurementUnit unit

The unit to which the value is converted.

Property Value
Type Description
double

The converted numeric value.

Exceptions
Type Condition
ArgumentException

Thrown when the current unit cannot be converted to unit.

Unit

Specifies the measurement unit associated with Value.

Declaration
public ScreenMeasurementUnit Unit { get; set; }
Property Value
Type Description
ScreenMeasurementUnit

Value

Specifies the numeric measurement value.

Declaration
public double Value { get; set; }
Property Value
Type Description
double

Methods

GetValue(ScreenMeasurementUnit)

Converts the stored value to the specified measurement unit.

Declaration
public double GetValue(ScreenMeasurementUnit unit)
Parameters
Type Name Description
ScreenMeasurementUnit unit

The unit to which the value is converted.

Returns
Type Description
double

The converted numeric value.

Exceptions
Type Condition
ArgumentException

Thrown when the current unit cannot be converted to unit.

GetValue(ScreenMeasurementUnit, UnitConversionOptions)

Converts the stored value to the specified measurement unit using the supplied conversion options.

Declaration
public double GetValue(ScreenMeasurementUnit unit, UnitConversionOptions options)
Parameters
Type Name Description
ScreenMeasurementUnit unit

The unit to which the value is converted.

UnitConversionOptions options

Options that control the conversion.

Returns
Type Description
double

The converted numeric value.

Exceptions
Type Condition
ArgumentException

Thrown when the current unit cannot be converted to unit.

TryGetValue(ScreenMeasurementUnit, UnitConversionOptions, out double)

Attempts to convert the stored value to the specified measurement unit using the supplied conversion options.

Declaration
public bool TryGetValue(ScreenMeasurementUnit unit, UnitConversionOptions options, out double value)
Parameters
Type Name Description
ScreenMeasurementUnit unit

The unit to which the value is converted.

UnitConversionOptions options

Options that control the conversion.

double value

When this method returns, contains the converted value if conversion succeeds; otherwise, the default value.

Returns
Type Description
bool

true if conversion succeeds; otherwise, false.

TryGetValue(ScreenMeasurementUnit, out double)

Attempts to convert the stored value to the specified measurement unit.

Declaration
public bool TryGetValue(ScreenMeasurementUnit unit, out double value)
Parameters
Type Name Description
ScreenMeasurementUnit unit

The unit to which the value is converted.

double value

When this method returns, contains the converted value if conversion succeeds; otherwise, the default value.

Returns
Type Description
bool

true if conversion succeeds; otherwise, false.

Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX