Skip to main content

Struct Scalar

Represents a Scalar measurement. Implements standard interfaces for comparison, formatting, and conversion operations.

Assembly: Meadow.Units.dll​
View Source​
Declaration
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​
Declaration
public static Scalar Zero { get; }

Value​

Gets the scalar value

View Source​
Declaration
public double Value { get; }

Methods​

FromCanonical(double)​

Creates a Scalar instance from a canonical (One) value

View Source​
Declaration
public static Scalar FromCanonical(double value)
Returns​

Meadow.Units.Scalar

Parameters​
TypeName
System.Doublevalue

ToCanonical()​

Gets the value of the Scalar in Canonical (One) units

View Source​
Declaration
public double ToCanonical()
Returns​

System.Double

GetCanonicalUnitType()​

Gets the enum value that represents the canonical unit of measurement for this type.

View Source​
Declaration
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​
Declaration
[Pure]
public override bool Equals(object obj)
Returns​

System.Boolean: true if the specified object is equal to the current unit; otherwise, false.

Parameters​
TypeNameDescription
System.ObjectobjThe object to compare with the current unit.

GetHashCode()​

Returns the hash code for this unit.

View Source​
Declaration
[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​
Declaration
[Pure]
public bool Equals(Scalar other)
Returns​

System.Boolean: true if the units are equal; otherwise, false.

Parameters​
TypeNameDescription
Meadow.Units.ScalarotherThe unit to compare with the current unit.

CompareTo(Scalar)​

Compares the current unit with another unit.

View Source​
Declaration
[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​
TypeNameDescription
Meadow.Units.ScalarotherThe unit to compare with the current unit.

CompareTo(object)​

Compares the current unit with another object.

View Source​
Declaration
[Pure]
public int CompareTo(object obj)
Returns​

System.Int32: A value that indicates the relative order of the objects being compared.

Parameters​
TypeNameDescription
System.ObjectobjThe 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​
Declaration
[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​
Declaration
[Pure]
public string ToString(string format, IFormatProvider formatProvider)
Returns​

System.String: The value of the current instance in the specified format.

Parameters​
TypeNameDescription
System.StringformatThe 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​
Declaration
[Pure]
public string ToString(IFormatProvider provider)
Returns​

System.String

Parameters​
TypeName
System.IFormatProviderprovider

Implements​

  • Meadow.Units.IUnit<Meadow.Units.Scalar,Meadow.Units.Scalar.UnitType>
  • Meadow.Units.IUnit
  • System.IComparable
  • System.IFormattable