Struct DecimalQuantity<U>
A DecimalAmount paired with an IUnit. Formats
as "{Amount} {Unit}".
public readonly record struct DecimalQuantity<U> : IQuantity<DecimalAmount, U>, IEquatable<IQuantity<DecimalAmount, U>>, IEquatable<DecimalQuantity<U>> where U : IUnit
Type Parameters
UConcrete unit type.
- Implements
- Inherited Members
Constructors
DecimalQuantity(DecimalAmount, U)
A DecimalAmount paired with an IUnit. Formats
as "{Amount} {Unit}".
public DecimalQuantity(DecimalAmount Amount, U Unit)
Parameters
AmountDecimalAmountUnitU
Properties
Amount
The numeric part.
public DecimalAmount Amount { get; init; }
Property Value
Unit
The unit part.
public U Unit { get; init; }
Property Value
- U
Methods
Equals(DecimalQuantity<U>)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(DecimalQuantity<U> other)
Parameters
otherDecimalQuantity<U>An object to compare with this object.
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.