Struct UnitValue
Represents a measurement with units
Assembly: SharpRtfConvert.dll
Syntax
public struct UnitValue : IEquatable<UnitValue>, IComparable<UnitValue>
Constructors
|
Edit this page
View Source
UnitValue(double, UnitType)
Declaration
public UnitValue(double value, UnitType unit)
Parameters
| Type |
Name |
Description |
| double |
value |
The measurement value
|
| UnitType |
unit |
The measurement unit
|
Properties
|
Edit this page
View Source
Empty
Declaration
public static UnitValue Empty { get; }
Property Value
|
Edit this page
View Source
HasValue
Gets whether or not the unit has been initialied with a value
Declaration
public bool HasValue { get; }
Property Value
|
Edit this page
View Source
Unit
Gets or sets the units of the measurement
Declaration
public UnitType Unit { readonly get; set; }
Property Value
|
Edit this page
View Source
Value
Gets or sets the value of the measurement
Declaration
public double Value { readonly get; set; }
Property Value
Methods
|
Edit this page
View Source
Average(IEnumerable<UnitValue>)
Declaration
public static UnitValue Average(IEnumerable<UnitValue> values)
Parameters
Returns
|
Edit this page
View Source
CompareTo(UnitValue)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Declaration
public int CompareTo(UnitValue other)
Parameters
| Type |
Name |
Description |
| UnitValue |
other |
An object to compare with this instance.
|
Returns
| Type |
Description |
| int |
A value that indicates the relative order of the objects being compared. The return value has these meanings:
| Value | Meaning |
|---|
| Less than zero | This instance precedes other in the sort order. | | Zero | This instance occurs in the same position in the sort order as other. | | Greater than zero | This instance follows other in the sort order. |
|
|
Edit this page
View Source
Equals(UnitValue)
Whether this measurement is exactly equal (in value and unit) to another measurement
Declaration
public bool Equals(UnitValue other)
Parameters
| Type |
Name |
Description |
| UnitValue |
other |
Another measurement
|
Returns
| Type |
Description |
| bool |
true if they are equal. false otherwise
|
|
Edit this page
View Source
Equals(object?)
Whether this measurement is exactly equal (in value and unit) to another measurement
Declaration
public override bool Equals(object? obj)
Parameters
| Type |
Name |
Description |
| object |
obj |
Another measurement
|
Returns
| Type |
Description |
| bool |
true if they are equal. false otherwise
|
Overrides
|
Edit this page
View Source
FromHalfPoint(int)
Declaration
public static UnitValue FromHalfPoint(int value)
Parameters
| Type |
Name |
Description |
| int |
value |
|
Returns
|
Edit this page
View Source
FromQuarterPoint(int)
Declaration
public static UnitValue FromQuarterPoint(int value)
Parameters
| Type |
Name |
Description |
| int |
value |
|
Returns
|
Edit this page
View Source
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type |
Description |
| int |
A 32-bit signed integer that is the hash code for this instance.
|
Overrides
|
Edit this page
View Source
ToPt()
Convert the measurement to points
Declaration
Returns
| Type |
Description |
| double |
The measuremet value in points
|
|
Edit this page
View Source
ToPx()
Convert the measurement value to pixels
Declaration
Returns
| Type |
Description |
| double |
The measurement in the corresponding number of pixels
|
|
Edit this page
View Source
ToTwip()
Convert the measurement to twips
Declaration
Returns
| Type |
Description |
| int |
The measurement in twips
|
Operators
|
Edit this page
View Source
operator +(UnitValue, UnitValue)
Declaration
public static UnitValue operator +(UnitValue a, UnitValue b)
Parameters
Returns
|
Edit this page
View Source
operator /(UnitValue, double)
Declaration
public static UnitValue operator /(UnitValue a, double b)
Parameters
Returns
|
Edit this page
View Source
operator ==(UnitValue, UnitValue)
Declaration
public static bool operator ==(UnitValue a, UnitValue b)
Parameters
Returns
|
Edit this page
View Source
operator >(UnitValue, UnitValue)
Declaration
public static bool operator >(UnitValue a, UnitValue b)
Parameters
Returns
|
Edit this page
View Source
operator >=(UnitValue, UnitValue)
Declaration
public static bool operator >=(UnitValue a, UnitValue b)
Parameters
Returns
|
Edit this page
View Source
operator !=(UnitValue, UnitValue)
Declaration
public static bool operator !=(UnitValue a, UnitValue b)
Parameters
Returns
|
Edit this page
View Source
operator <(UnitValue, UnitValue)
Declaration
public static bool operator <(UnitValue a, UnitValue b)
Parameters
Returns
|
Edit this page
View Source
operator <=(UnitValue, UnitValue)
Declaration
public static bool operator <=(UnitValue a, UnitValue b)
Parameters
Returns
|
Edit this page
View Source
operator *(UnitValue, double)
Declaration
public static UnitValue operator *(UnitValue a, double b)
Parameters
Returns
|
Edit this page
View Source
operator -(UnitValue, UnitValue)
Declaration
public static UnitValue operator -(UnitValue a, UnitValue b)
Parameters
Returns
Implements