C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
AnalyzeRe.MonetaryUnit Class Reference

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.

See also
ExtensionMethods.DeepCopy<T>

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.
 

Detailed Description

Representation of a monetary value with a currency.

Definition at line 13 of file MonetaryUnit.cs.

Inheritance diagram for AnalyzeRe.MonetaryUnit:
AnalyzeRe.APIType AnalyzeRe.IAPIType

Constructor & Destructor Documentation

◆ MonetaryUnit() [1/4]

AnalyzeRe.MonetaryUnit.MonetaryUnit ( )
inline

Construct an empty monetary unit.

Definition at line 106 of file MonetaryUnit.cs.

◆ MonetaryUnit() [2/4]

AnalyzeRe.MonetaryUnit.MonetaryUnit ( double  value,
string  currency 
)
inline

Construct a new monetary unit.

Parameters
valueThe value of the monetary unit.
currencyThe 3-letter currency code based on ISO 4217.

Definition at line 113 of file MonetaryUnit.cs.

◆ MonetaryUnit() [3/4]

AnalyzeRe.MonetaryUnit.MonetaryUnit ( double  value,
string  currency,
DateTime  value_date 
)
inline

Construct a new monetary unit with a preferred exchange rate conversion date.

Parameters
valueThe value of the monetary unit.
currencyThe 3-letter currency code based on ISO 4217.
value_dateThe 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.

◆ MonetaryUnit() [4/4]

AnalyzeRe.MonetaryUnit.MonetaryUnit ( double  value,
string  currency,
double  rate,
string  rate_currency 
)
inline

Construct a new monetary unit with a fixed exchange rate conversion.

Parameters
valueThe value of the monetary unit.
currencyThe 3-letter currency code based on ISO 4217.
rateThe 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_currency3-letter currency code that indicates the currency that the 'rate' parameter is the rate for.

Definition at line 140 of file MonetaryUnit.cs.

Member Function Documentation

◆ AfterMembersCloned()

virtual void AnalyzeRe.APIType.AfterMembersCloned ( APIType  originalResource)
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.

◆ Equals() [1/2]

bool AnalyzeRe.MonetaryUnit.Equals ( MonetaryUnit  other)

Determine if this MonetaryUnit is equivalent to another.

Parameters
otherThe MonetaryUnit to compare to this.

◆ Equals() [2/2]

override bool AnalyzeRe.MonetaryUnit.Equals ( object  obj)

Determine if this MonetaryUnit is equivalent to another object.

Parameters
objObject to compare to this.
Returns
True if the other object is a MonetaryUnit and it is equivalent to this.

◆ GetHashCode()

override int AnalyzeRe.MonetaryUnit.GetHashCode ( )
inline

Get the HashCode for this MonetaryUnit.

Returns
A unique HashCode for this MonetaryUnit

Definition at line 189 of file MonetaryUnit.cs.

◆ ShallowCopy< T >()

virtual T AnalyzeRe.APIType.ShallowCopy< T > ( )
inlinevirtualinherited

Create a shallow copy of this object.

See also
ExtensionMethods.DeepCopy<T>

for a serializer-based copy method.

Returns
A shallow copy of this object.

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.

Type Constraints
T :IAPIType 

Definition at line 14 of file APIType.cs.

◆ ToString()

override string AnalyzeRe.MonetaryUnit.ToString ( )
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.

Returns
The string representation of this MonetaryUnit

Definition at line 156 of file MonetaryUnit.cs.

Property Documentation

◆ currency

string AnalyzeRe.MonetaryUnit.currency
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.

◆ rate

double? AnalyzeRe.MonetaryUnit.rate
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.

◆ rate_currency

string AnalyzeRe.MonetaryUnit.rate_currency
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.

◆ value

double AnalyzeRe.MonetaryUnit.value
getset

The value of the monetary unit.

Definition at line 47 of file MonetaryUnit.cs.

◆ value_date

DateTime? AnalyzeRe.MonetaryUnit.value_date
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.


The documentation for this class was generated from the following file: