Struct Amount
Represents monetary amount with currency
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Azos.dll
Syntax
[Serializable]
public struct Amount : IEquatable<Amount>, IComparable<Amount>, IJSONWritable
Constructors
Amount(String, Decimal)
Declaration
public Amount(string currencyISO, decimal value)
Parameters
Type |
Name |
Description |
System.String |
currencyISO |
|
System.Decimal |
value |
|
Properties
CurrencyISO
Declaration
public string CurrencyISO { get; }
Property Value
Type |
Description |
System.String |
|
IsEmpty
Declaration
public bool IsEmpty { get; }
Property Value
Type |
Description |
System.Boolean |
|
Value
Declaration
public decimal Value { get; }
Property Value
Type |
Description |
System.Decimal |
|
Methods
CompareTo(Amount)
Declaration
public int CompareTo(Amount other)
Parameters
Type |
Name |
Description |
Amount |
other |
|
Returns
Type |
Description |
System.Int32 |
|
Equals(Amount)
Declaration
public bool Equals(Amount other)
Parameters
Type |
Name |
Description |
Amount |
other |
|
Returns
Type |
Description |
System.Boolean |
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
System.ValueType.Equals(System.Object)
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
IsSameCurrencyAs(Amount)
Perfoms case-insensitive currency equality comparison
Declaration
public bool IsSameCurrencyAs(Amount other)
Parameters
Type |
Name |
Description |
Amount |
other |
|
Returns
Type |
Description |
System.Boolean |
|
Parse(String)
Declaration
public static Amount Parse(string val)
Parameters
Type |
Name |
Description |
System.String |
val |
|
Returns
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
System.ValueType.ToString()
TryParse(String, out Amount)
Declaration
public static bool TryParse(string val, out Amount result)
Parameters
Type |
Name |
Description |
System.String |
val |
|
Amount |
result |
|
Returns
Type |
Description |
System.Boolean |
|
WriteAsJSON(TextWriter, Int32, JSONWritingOptions)
Declaration
public void WriteAsJSON(TextWriter wri, int nestingLevel, JSONWritingOptions options = null)
Parameters
Type |
Name |
Description |
System.IO.TextWriter |
wri |
|
System.Int32 |
nestingLevel |
|
JSONWritingOptions |
options |
|
Operators
Addition(Amount, Amount)
Declaration
public static Amount operator +(Amount left, Amount right)
Parameters
Returns
Division(Amount, Decimal)
Declaration
public static Amount operator /(Amount left, decimal right)
Parameters
Type |
Name |
Description |
Amount |
left |
|
System.Decimal |
right |
|
Returns
Division(Amount, Double)
Declaration
public static Amount operator /(Amount left, double right)
Parameters
Type |
Name |
Description |
Amount |
left |
|
System.Double |
right |
|
Returns
Division(Amount, Int32)
Declaration
public static Amount operator /(Amount left, int right)
Parameters
Type |
Name |
Description |
Amount |
left |
|
System.Int32 |
right |
|
Returns
Equality(Amount, Amount)
Declaration
public static bool operator ==(Amount left, Amount right)
Parameters
Returns
Type |
Description |
System.Boolean |
|
GreaterThan(Amount, Amount)
Declaration
public static bool operator>(Amount left, Amount right)
Parameters
Returns
Type |
Description |
System.Boolean |
|
GreaterThanOrEqual(Amount, Amount)
Declaration
public static bool operator >=(Amount left, Amount right)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Inequality(Amount, Amount)
Declaration
public static bool operator !=(Amount left, Amount right)
Parameters
Returns
Type |
Description |
System.Boolean |
|
LessThan(Amount, Amount)
Declaration
public static bool operator <(Amount left, Amount right)
Parameters
Returns
Type |
Description |
System.Boolean |
|
LessThanOrEqual(Amount, Amount)
Declaration
public static bool operator <=(Amount left, Amount right)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Multiply(Amount, Decimal)
Declaration
public static Amount operator *(Amount left, decimal right)
Parameters
Type |
Name |
Description |
Amount |
left |
|
System.Decimal |
right |
|
Returns
Multiply(Amount, Double)
Declaration
public static Amount operator *(Amount left, double right)
Parameters
Type |
Name |
Description |
Amount |
left |
|
System.Double |
right |
|
Returns
Multiply(Amount, Int32)
Declaration
public static Amount operator *(Amount left, int right)
Parameters
Type |
Name |
Description |
Amount |
left |
|
System.Int32 |
right |
|
Returns
Multiply(Decimal, Amount)
Declaration
public static Amount operator *(decimal left, Amount right)
Parameters
Type |
Name |
Description |
System.Decimal |
left |
|
Amount |
right |
|
Returns
Multiply(Double, Amount)
Declaration
public static Amount operator *(double left, Amount right)
Parameters
Type |
Name |
Description |
System.Double |
left |
|
Amount |
right |
|
Returns
Multiply(Int32, Amount)
Declaration
public static Amount operator *(int left, Amount right)
Parameters
Type |
Name |
Description |
System.Int32 |
left |
|
Amount |
right |
|
Returns
Subtraction(Amount, Amount)
Declaration
public static Amount operator -(Amount left, Amount right)
Parameters
Returns
Implements
System.IEquatable<T>
System.IComparable<T>
Extension Methods