Table of Contents

Class Currency

Namespace
Ecng.Common
Assembly
Ecng.Common.dll

Currency.

[DataContract]
public class Currency : Equatable<Currency>, ICloneable<Currency>, ICloneable, IEquatable<Currency>, IComparable<Currency>, IComparable
Inheritance
Currency
Implements
Inherited Members
Extension Methods

Constructors

Currency()

public Currency()

Properties

Type

Currency type. The default is USD.

[DataMember]
public CurrencyTypes Type { get; set; }

Property Value

CurrencyTypes

Value

Absolute value in CurrencyTypes.

[DataMember]
public decimal Value { get; set; }

Property Value

decimal

Methods

Clone()

Create a copy of Currency.

public override Currency Clone()

Returns

Currency

Copy.

GetHashCode()

Get the hash code of the object Currency.

public override int GetHashCode()

Returns

int

A hash code.

OnEquals(Currency)

Compare Currency on the equivalence.

protected override bool OnEquals(Currency other)

Parameters

other Currency

Another value with which to compare.

Returns

bool

true, if the specified object is equal to the current object, otherwise, false.

ToString()

public override string ToString()

Returns

string

Operators

operator +(Currency, Currency)

Add the two objects Currency.

public static Currency operator +(Currency c1, Currency c2)

Parameters

c1 Currency

First object Currency.

c2 Currency

Second object Currency.

Returns

Currency

The result of addition.

Remarks

The values must be the same Type.

operator /(Currency, Currency)

Divide one value to another.

public static Currency operator /(Currency c1, Currency c2)

Parameters

c1 Currency

First object Currency.

c2 Currency

Second object Currency.

Returns

Currency

The result of the division.

explicit operator decimal(Currency)

Cast object from Currency to decimal.

[Obsolete]
public static explicit operator decimal(Currency value)

Parameters

value Currency

Object Currency.

Returns

decimal

decimal value.

implicit operator Currency(decimal)

Cast decimal object to the type Currency.

[Obsolete]
public static implicit operator Currency(decimal value)

Parameters

value decimal

decimal value.

Returns

Currency

Object Currency.

operator *(Currency, Currency)

Multiply one value to another.

public static Currency operator *(Currency c1, Currency c2)

Parameters

c1 Currency

First object Currency.

c2 Currency

Second object Currency.

Returns

Currency

The result of the multiplication.

operator -(Currency, Currency)

Subtract one value from another value.

public static Currency operator -(Currency c1, Currency c2)

Parameters

c1 Currency

First object Currency.

c2 Currency

Second object Currency.

Returns

Currency

The result of the subtraction.