C# Client Library
A C# Client Library for the AnalyzeRe REST API
AnalyzeRe.MonetaryUnit Class Reference

Representation of a monetary value with a currency. More...

Public Member Functions

 MonetaryUnit ()
 Construct an empty monetary unit More...
 
 MonetaryUnit (double value, string currency)
 Construct a new monetary unit. More...
 
 MonetaryUnit (double value, string currency, DateTime value_date)
 Construct a new monetary unit with a preferred exchange rate conversion date. More...
 
 MonetaryUnit (double value, string currency, double rate, string rate_currency)
 Construct a new monetary unit with a fixed exchange rate conversion. More...
 
override bool Equals (object obj)
 Determine if this MonetaryUnit is equivalent to another. More...
 
override int GetHashCode ()
 Get the HashCode for this MonetaryUnit More...
 
virtual T ShallowCopy< T > ()
 Create a shallow copy of this object.

See also
ExtensionMethods.DeepCopy<T>

for a serializer-based copy method. More...

 
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. More...
 

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. More...
 

Properties

string currency [get, set]
 3-letter currency code based on ISO 4217 (see: http://en.wikipedia.org/wiki/ISO_4217) More...
 
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. More...
 
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. More...
 
double value [get, set]
 The value of the monetary unit. More...
 
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. More...
 

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

AnalyzeRe.MonetaryUnit.MonetaryUnit ( )
inline

Construct an empty monetary unit

Definition at line 106 of file MonetaryUnit.cs.

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.

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.

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

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.APIResourceView.BaseAPIResourceView, AnalyzeRe.Optimization.OptimizationView, AnalyzeRe.Optimization.Candidate, AnalyzeRe.StaticSimulation, AnalyzeRe.Distributions.CustomDistribution, AnalyzeRe.LossSets.LossSet_WithData, and AnalyzeRe.APITypes.APIResource_WithDataEndpoint.

Definition at line 37 of file APIType.cs.

override bool AnalyzeRe.MonetaryUnit.Equals ( object  obj)
inline

Determine if this MonetaryUnit is equivalent to another.

Parameters
objObject to compare to this.
Returns
True if the other object is a MonetaryUnit and the currency and value are the same.

Definition at line 174 of file MonetaryUnit.cs.

override int AnalyzeRe.MonetaryUnit.GetHashCode ( )
inline

Get the HashCode for this MonetaryUnit

Returns
A unique HashCode for this MonetaryUnit

Definition at line 186 of file MonetaryUnit.cs.

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.

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

string AnalyzeRe.MonetaryUnit.currency
getset

3-letter currency code based on ISO 4217 (see: http://en.wikipedia.org/wiki/ISO_4217)

Definition at line 36 of file MonetaryUnit.cs.

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 78 of file MonetaryUnit.cs.

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 92 of file MonetaryUnit.cs.

double AnalyzeRe.MonetaryUnit.value
getset

The value of the monetary unit.

Definition at line 48 of file MonetaryUnit.cs.

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 62 of file MonetaryUnit.cs.


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