Price

Ecng.ComponentModel

Represents a price with a specific value and type.

Implementa: IComparable<Price>, IEquatable<Price>, IPersistable, IOperable<Price>, IFormattable

Construtores

Price
public Price(decimal value, PriceTypes type)
price = Price(value, type)

Initializes a new instance of the Price class with the specified value and type.

value
The numeric value.
type
The price type (measure).
Price
public Price()
price = Price()

Initializes a new instance of the Price class.

Propriedades

Type
public PriceTypes Type { get; set; }
value = price.Type
price.Type = value

Gets or sets the price type.

Value
public decimal Value { get; set; }
value = price.Value
price.Value = value

Gets or sets the numeric value of the price.

Métodos

CompareTo
public int CompareTo(Price other)
result = price.CompareTo(other)

Compares the current instance with another Price object.

other
The other Price to compare with.

Retorna: A value less than zero if this instance is less than , zero if they are equal, or a value greater than zero if this instance is greater than .

Equals
public bool Equals(Price other)
result = price.Equals(other)
Equals
public override bool Equals(object obj)
result = price.Equals(obj)

Determines whether the specified object is equal to the current object.

obj
The object to compare with this object.

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

GetHashCode
public override int GetHashCode()
result = price.GetHashCode()

Computes a hash code for this tuple based on its values.

Retorna: A hash code for the tuple.

op_Addition
public static Price op_Addition(Price v1, Price v2)
result = Price.op_Addition(v1, v2)

Adds two Price instances.

v1
The first Price.
v2
The second Price.

Retorna: The sum of the two prices.

op_Division
public static Price op_Division(Price v1, Price v2)
result = Price.op_Division(v1, v2)

Divides one Price by another.

v1
The numerator Price.
v2
The denominator Price.

Retorna: The quotient of the division.

op_Equality
public static bool op_Equality(Price v1, Price v2)
result = Price.op_Equality(v1, v2)

Determines whether two Price objects are equal.

v1
The first Price object.
v2
The second Price object.

Retorna: true if the prices are equal; otherwise, false.

op_Explicit(Double) : decimal

Explicitly converts a Price to a Double.

value
The Price to convert.

Retorna: The double representation of the price value.

op_Explicit(Decimal) : decimal

Explicitly converts a Price to a Decimal.

value
The Price to convert.

Retorna: The decimal representation of the price value.

op_GreaterThan
public static bool op_GreaterThan(Price v1, Price v2)
result = Price.op_GreaterThan(v1, v2)

Determines whether one Price is greater than another.

v1
The first Price.
v2
The second Price.

Retorna: true if is greater than ; otherwise, false.

op_GreaterThanOrEqual
public static bool op_GreaterThanOrEqual(Price v1, Price v2)
result = Price.op_GreaterThanOrEqual(v1, v2)

Determines whether one Price is greater than or equal to another.

v1
The first Price.
v2
The second Price.

Retorna: true if is greater than or equal to ; otherwise, false.

op_Implicit(Price) : Price

Implicitly converts an Int32 to a Price.

value
The integer value to convert.

Retorna: A new Price with the specified value.

op_Implicit(Price) : Price

Implicitly converts a Decimal to a Price.

value
The decimal value to convert.

Retorna: A new Price with the specified value.

op_Inequality
public static bool op_Inequality(Price v1, Price v2)
result = Price.op_Inequality(v1, v2)

Determines whether two Price objects are not equal.

v1
The first Price object.
v2
The second Price object.

Retorna: true if the prices are not equal; otherwise, false.

op_LessThan
public static bool op_LessThan(Price v1, Price v2)
result = Price.op_LessThan(v1, v2)

Determines whether one Price is less than another.

v1
The first Price.
v2
The second Price.

Retorna: true if is less than ; otherwise, false.

op_LessThanOrEqual
public static bool op_LessThanOrEqual(Price v1, Price v2)
result = Price.op_LessThanOrEqual(v1, v2)

Determines whether one Price is less than or equal to another.

v1
The first Price.
v2
The second Price.

Retorna: true if is less than or equal to ; otherwise, false.

op_Multiply
public static Price op_Multiply(Price v1, Price v2)
result = Price.op_Multiply(v1, v2)

Multiplies two Price instances.

v1
The first Price.
v2
The second Price.

Retorna: The product of the two prices.

op_Subtraction
public static Price op_Subtraction(Price v1, Price v2)
result = Price.op_Subtraction(v1, v2)

Subtracts one Price from another.

v1
The Price to subtract from.
v2
The Price to subtract.

Retorna: The difference of the two prices.

op_UnaryNegation
public static Price op_UnaryNegation(Price v)
result = Price.op_UnaryNegation(v)

Returns a Price whose value is the negation of the specified price.

v
The Price to negate.

Retorna: A new Price with the opposite sign.

ToString
public override string ToString()
result = price.ToString()

Returns a string representation of the tuple, with values separated by commas.

Retorna: A string representing the tuple's values.

ToString
public string ToString(string format, IFormatProvider formatProvider)
result = price.ToString(format, formatProvider)

Campos

LimitChar
public const char LimitChar
value = Price.LimitChar

Limit sign.

PercentChar
public const char PercentChar
value = Price.PercentChar

Percent sign.