Class DoubleUnit
Double value and its unit.
Inherited Members
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 |
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
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 |
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 |
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 |
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 |