Struct Money
An amount of money
Implements
System.IEquatable<Money>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: EC.ProductsAndPricing.ServiceContract
Assembly: EC.ProductsAndPricing.ServiceContract.dll
Syntax
public struct Money : IEquatable<Money>
Constructors
View SourceMoney(String, Decimal)
Create money with specific currency and amount
Declaration
public Money(string currencyCode, decimal amount)
Parameters
Type | Name | Description |
---|---|---|
System.String | currencyCode | The 3 letter ISO currency code of the currency |
System.Decimal | amount | The amount of money |
Properties
View SourceAmount
The amount of money
Declaration
public decimal Amount { get; set; }
Property Type:
System.Decimal
View Source
Currency
The ISO Currency code of the currency
Declaration
public string Currency { get; set; }
Property Type:
System.String
Methods
View SourceEquals(Money)
Compare two monetry amounts
Declaration
public bool Equals(Money other)
Parameters
Type | Name | Description |
---|---|---|
Money | other | The object to compare to |
Returns
Type | Description |
---|---|
System.Boolean |
|
Implements
System.IEquatable<T>.Equals(T)
View Source
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)
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
System.ValueType.GetHashCode()
View Source
Parse(String)
Parse a money value.
Declaration
public static Money Parse(string str)
Parameters
Type | Name | Description |
---|---|---|
System.String | str | The string to parse |
Returns
Type | Description |
---|---|
Money | The parsed value |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If |
ToString()
Format money
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string representing the monetry amount |
Overrides
System.ValueType.ToString()
View Source
TryParse(String, out Money)
Try to parse a monetry amount.
Declaration
public static bool TryParse(string str, out Money money)
Parameters
Type | Name | Description |
---|---|---|
System.String | str | A string to parse. |
Money | money | The value that was parsed. |
Returns
Type | Description |
---|---|
System.Boolean |
|