Class CommodityUnitCost
- Namespace
- NanoQL.Experimental
- Assembly
- NanoQL.dll
A cost per unit of a commodity: an amount of money per unit of measure, such as 0.1 USD a gallon.
[Experimental("NQL0001")]
public sealed class CommodityUnitCost
- Inheritance
-
CommodityUnitCost
- Inherited Members
Remarks
Immutable. QuantLib's default CommodityUnitCost(), a zero amount in no currency per no unit, is
new CommodityUnitCost(default, null).
Constructors
CommodityUnitCost(Money, UnitOfMeasure?)
Initializes a new instance of the CommodityUnitCost class.
public CommodityUnitCost(Money amount, UnitOfMeasure? unitOfMeasure)
Parameters
amountMoneyThe amount per unit.
unitOfMeasureUnitOfMeasureThe unit the amount is per; null for QuantLib's empty one.
Properties
Amount
Gets the amount per unit.
public Money Amount { get; }
Property Value
UnitOfMeasure
Gets the unit the amount is per; null for QuantLib's empty one.
public UnitOfMeasure? UnitOfMeasure { get; }
Property Value
Methods
ToString()
The cost as QuantLib's operator<< writes it: the amount's value in C++'s default stream format, the
currency's code, a slash and the unit's code ("0.1 USD/GAL").
public override string ToString()
Returns
- string
The text.
Exceptions
- NanoQLException
The currency or the unit is QuantLib's empty one.