Amount
A Vendr amount object
public class Amount : ValueObjectBase, IAmount
Inheritance
- class ValueObjectBase
- interface IAmount
Namespace
Constructors
Amount (1 of 2)
Instantiates a new Amount
instance
public Amount(decimal value, Guid currencyId)
Parameters
Parameter | Description |
---|---|
value |
The value of the amount |
currencyId |
The ID of the Currency of the price |
Amount (2 of 2)
Instantiates a new Amount
instance
public Amount(decimal value, CurrencyReadOnly currency)
Parameters
Parameter | Description |
---|---|
value |
The value of the amount |
currency |
The Currency of the price |
Properties
CultureName
Gets the Culture Name of the Currency
of the amount
public string CultureName { get; }
CurrencyId
Gets the ID of the Currency
of the amount
public Guid CurrencyId { get; }
Value
Gets the value of the amount
public decimal Value { get; }
Methods
OfSameCurrency
Create a new Amount
of the same Currency
as an existing amount
public static Amount OfSameCurrency(Amount existingAmount, decimal value)
Parameters
Parameter | Description |
---|---|
existingAmount |
The existing Amount instance |
value |
The value of the new amount |
Returns
A new Amount
instance
ZeroValue
Instantiates a new Amount
instance with a zero value
public static Amount ZeroValue(Guid currencyId)
Parameters
Parameter | Description |
---|---|
currencyId |
The ID of the Currency of the amount |
Returns
A zero value Amount
instance
DeepClone
public override object DeepClone()
Operators
Amount Implicit
public static implicit operator decimal(Amount amount)