C# Client Library
A C# Client Library for the AnalyzeRe REST API
|
Representation of a monetary value with a currency. More...
Public Member Functions | |
MonetaryUnit () | |
Construct an empty monetary unit. | |
MonetaryUnit (double value, string currency) | |
Construct a new monetary unit. | |
MonetaryUnit (double value, string currency, DateTime value_date) | |
Construct a new monetary unit with a preferred exchange rate conversion date. | |
MonetaryUnit (double value, string currency, double rate, string rate_currency) | |
Construct a new monetary unit with a fixed exchange rate conversion. | |
bool | Equals (MonetaryUnit other) |
Determine if this MonetaryUnit is equivalent to another. | |
override bool | Equals (object obj) |
Determine if this MonetaryUnit is equivalent to another object. | |
override int | GetHashCode () |
Get the HashCode for this MonetaryUnit. | |
virtual T | ShallowCopy< T > () |
Create a shallow copy of this object.
for a serializer-based copy method. | |
override string | ToString () |
String representation of this MonetaryUnit's currency and value, and of its fixed exchange rate properties, if any. Values with magnitude between 1000 and 1e18 are displayed as "N2" (i.e. with 'thousands' indicators and two decimal places - common for money). Otherwise defaults to the standard "G" format, which may resort to exponential notation and displays up to 15 significant digits of precision. | |
Protected Member Functions | |
virtual void | AfterMembersCloned (APIType originalResource) |
Invoked following construction if the current instance has been created using a member-wise clone of some other instance. Override if your derived APIType class contains some members that should not be cloned. | |
Properties | |
string | currency [get, set] |
3-letter currency code based on ISO 4217 (see: https://en.wikipedia.org/wiki/ISO_4217) | |
double? | rate [get, set] |
The fixed rate to use whenever using this monetary unit and a currency conversion is required. If null, the exchange rate to use will be determined by the active ExchangeRateProfile. Warning, specifying this rate will override the exchange rate to/from ANY currency, which is rarely correct, so use with caution. | |
string | rate_currency [get, set] |
3-letter currency code that indicates the currency that the 'rate' parameter is the rate for. Must be supplied if 'rate' is supplied. | |
double | value [get, set] |
The value of the monetary unit. | |
DateTime? | value_date [get, set] |
The date for which to retrieve the exchange rate whenever using this monetary unit and a currency conversion is required. If null, the date to use will be determined by the active ExchangeRateProfile. | |
Representation of a monetary value with a currency.
Definition at line 13 of file MonetaryUnit.cs.
|
inline |
Construct an empty monetary unit.
Definition at line 106 of file MonetaryUnit.cs.
|
inline |
Construct a new monetary unit.
value | The value of the monetary unit. |
currency | The 3-letter currency code based on ISO 4217. |
Definition at line 113 of file MonetaryUnit.cs.
|
inline |
Construct a new monetary unit with a preferred exchange rate conversion date.
value | The value of the monetary unit. |
currency | The 3-letter currency code based on ISO 4217. |
value_date | The date for which to retrieve the exchange rate whenever using this monetary unit and a currency conversion is required. If null, the date to use will be determined by the active ExchangeRateProfile. |
Definition at line 125 of file MonetaryUnit.cs.
|
inline |
Construct a new monetary unit with a fixed exchange rate conversion.
value | The value of the monetary unit. |
currency | The 3-letter currency code based on ISO 4217. |
rate | The fixed rate to use whenever using this monetary unit and a currency conversion is required. If null, the exchange rate to use will be determined by the active ExchangeRateProfile. Warning, specifying this rate will override the exchange rate to/from ANY currency, which is rarely correct, so use with caution. |
rate_currency | 3-letter currency code that indicates the currency that the 'rate' parameter is the rate for. |
Definition at line 140 of file MonetaryUnit.cs.
|
inlineprotectedvirtualinherited |
Invoked following construction if the current instance has been created using a member-wise clone of some other instance. Override if your derived APIType class contains some members that should not be cloned.
Overriding implementations should be sure to invoke base.AfterMembersCloned().
A sane question for a code reviewer to ask might be: "Why not avoid copying those members in the first place?" The answer is that there is no framework-supported method of excluding members from a MemberwiseClone. The only officially supported solution is to not use the object.MemberwiseClone method at all and instead have each class implement it's own Copy method. In our case, most objects have no need to specialize their copy implementation (even though they could - the ShallowCopy<T> method is marked virtual). It's simpler to simply "correct" any special-case members after the fact, and requires less error-prone code than if the code were responsible for ensuring no members were missed in a copy. It's also faster than any reflection-based approach, even though such an approach could benefit from custom attributes meant to exclude certain members from copying.
Reimplemented in AnalyzeRe.APITypes.APIResource_WithDataEndpoint, AnalyzeRe.APIResourceView.BaseAPIResourceView, AnalyzeRe.Distributions.CustomDistribution, AnalyzeRe.LossSets.LossSet_WithData, AnalyzeRe.Optimization.Candidate, AnalyzeRe.Optimization.OptimizationView, and AnalyzeRe.StaticSimulation.
Definition at line 37 of file APIType.cs.
bool AnalyzeRe.MonetaryUnit.Equals | ( | MonetaryUnit | other | ) |
Determine if this MonetaryUnit is equivalent to another.
other | The MonetaryUnit to compare to this. |
override bool AnalyzeRe.MonetaryUnit.Equals | ( | object | obj | ) |
Determine if this MonetaryUnit is equivalent to another object.
obj | Object to compare to this. |
|
inline |
Get the HashCode for this MonetaryUnit.
Definition at line 189 of file MonetaryUnit.cs.
|
inlinevirtualinherited |
Create a shallow copy of this object.
for a serializer-based copy method.
If this object contains any members that reference the current object (this), the class should override this method to avoid cloning a reference to the old class.
Implements AnalyzeRe.IAPIType.
T | : | IAPIType |
Definition at line 14 of file APIType.cs.
|
inline |
String representation of this MonetaryUnit's currency and value, and of its fixed exchange rate properties, if any. Values with magnitude between 1000 and 1e18 are displayed as "N2" (i.e. with 'thousands' indicators and two decimal places - common for money). Otherwise defaults to the standard "G" format, which may resort to exponential notation and displays up to 15 significant digits of precision.
Definition at line 156 of file MonetaryUnit.cs.
|
getset |
3-letter currency code based on ISO 4217 (see: https://en.wikipedia.org/wiki/ISO_4217)
Definition at line 35 of file MonetaryUnit.cs.
|
getset |
The fixed rate to use whenever using this monetary unit and a currency conversion is required. If null, the exchange rate to use will be determined by the active ExchangeRateProfile. Warning, specifying this rate will override the exchange rate to/from ANY currency, which is rarely correct, so use with caution.
Definition at line 77 of file MonetaryUnit.cs.
|
getset |
3-letter currency code that indicates the currency that the 'rate' parameter is the rate for. Must be supplied if 'rate' is supplied.
Definition at line 91 of file MonetaryUnit.cs.
|
getset |
The value of the monetary unit.
Definition at line 47 of file MonetaryUnit.cs.
|
getset |
The date for which to retrieve the exchange rate whenever using this monetary unit and a currency conversion is required. If null, the date to use will be determined by the active ExchangeRateProfile.
Definition at line 61 of file MonetaryUnit.cs.