Struct Scalar
Represents a Scalar measurement. Implements standard interfaces for comparison, formatting, and conversion operations.
Assembly: Meadow.Units.dll
View Source
public struct Scalar : IUnit<Scalar, Scalar.UnitType>, IUnit, IComparable, IFormattable
Implements:
Meadow.Units.IUnit<Meadow.Units.Scalar,Meadow.Units.Scalar.UnitType>, Meadow.Units.IUnit, System.IComparable, System.IFormattable
Properties
Zero
Gets a scalar 0
View Source
public static Scalar Zero { get; }
Value
Gets the scalar value
View Source
public double Value { get; }
Methods
FromCanonical(double)
Creates a Scalar instance from a canonical (One) value
View Source
public static Scalar FromCanonical(double value)
Returns
Parameters
| Type | Name |
|---|---|
System.Double | value |
ToCanonical()
Gets the value of the Scalar in Canonical (One) units
View Source
public double ToCanonical()
Returns
System.Double
GetCanonicalUnitType()
Gets the enum value that represents the canonical unit of measurement for this type.
View Source
public Scalar.UnitType GetCanonicalUnitType()
Returns
Meadow.Units.Scalar.UnitType: The canonical unit type
Equals(object)
Determines whether the specified object is equal to the current unit.
View Source
[Pure]
public override bool Equals(object obj)
Returns
System.Boolean: true if the specified object is equal to the current unit; otherwise, false.
Parameters
| Type | Name | Description |
|---|---|---|
System.Object | obj | The object to compare with the current unit. |
GetHashCode()
Returns the hash code for this unit.
View Source
[Pure]
public override int GetHashCode()
Returns
System.Int32: A hash code value generated from the underlying numerical value.
Equals(Scalar)
Determines whether the specified unit is equal to the current unit.
View Source
[Pure]
public bool Equals(Scalar other)
Returns
System.Boolean: true if the units are equal; otherwise, false.
Parameters
| Type | Name | Description |
|---|---|---|
| Meadow.Units.Scalar | other | The unit to compare with the current unit. |
CompareTo(Scalar)
Compares the current unit with another unit.
View Source
[Pure]
public int CompareTo(Scalar other)
Returns
System.Int32: A value that indicates the relative order of the units being compared. Returns 0 if equal,
less than 0 if less than the other value, or greater than 0 if greater than the other value.
Parameters
| Type | Name | Description |
|---|---|---|
| Meadow.Units.Scalar | other | The unit to compare with the current unit. |
CompareTo(object)
Compares the current unit with another object.
View Source
[Pure]
public int CompareTo(object obj)
Returns
System.Int32: A value that indicates the relative order of the objects being compared.
Parameters
| Type | Name | Description |
|---|---|---|
System.Object | obj | The object to compare with the current unit. |
Exceptions
System.ArgumentException
The object is not a Scalar.
GetTypeCode()
Returns the TypeCode for the underlying value type.
View Source
[Pure]
public TypeCode GetTypeCode()
Returns
System.TypeCode: The TypeCode for the underlying double value.
ToString(string, IFormatProvider)
Formats the value of the current instance using the specified format.
View Source
[Pure]
public string ToString(string format, IFormatProvider formatProvider)
Returns
System.String: The value of the current instance in the specified format.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | format | The format to use. |
-or-
A null reference (Nothing in Visual Basic) to use the default format defined for the type of the System.IFormattable implementation. |
| System.IFormatProvider | formatProvider | The provider to use to format the value.
-or-
A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system. |
ToString(IFormatProvider)
View Source
[Pure]
public string ToString(IFormatProvider provider)
Returns
System.String
Parameters
| Type | Name |
|---|---|
System.IFormatProvider | provider |
Implements
Meadow.Units.IUnit<Meadow.Units.Scalar,Meadow.Units.Scalar.UnitType>- Meadow.Units.IUnit
System.IComparableSystem.IFormattable