Price
Represents a price with a specific value and type.
実装: IComparable<Price>, IEquatable<Price>, IPersistable, IOperable<Price>, IFormattable
コンストラクター
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).
プロパティ
public PriceTypes Type { get; set; }
value = price.Type
price.Type = value
Gets or sets the price type.
public decimal Value { get; set; }
value = price.Value
price.Value = value
Gets or sets the numeric value of the price.
メソッド
public int CompareTo(Price other)
result = price.CompareTo(other)
Compares the current instance with another Price object.
- other
- The other Price to compare with.
戻り値: 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 .
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.
戻り値: true if the specified object is equal to the current object; otherwise, false.
public override int GetHashCode()
result = price.GetHashCode()
Computes a hash code for this tuple based on its values.
戻り値: A hash code for the tuple.
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.
戻り値: The sum of the two prices.
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.
戻り値: The quotient of the division.
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.
戻り値: true if the prices are equal; otherwise, false.
op_Explicit(Double) : decimal
Explicitly converts a Price to a Double.
- value
- The Price to convert.
戻り値: The double representation of the price value.
op_Explicit(Decimal) : decimal
Explicitly converts a Price to a Decimal.
- value
- The Price to convert.
戻り値: The decimal representation of the price value.
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.
戻り値: true if is greater than ; otherwise, false.
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.
戻り値: 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.
戻り値: A new Price with the specified value.
op_Implicit(Price) : Price
Implicitly converts a Decimal to a Price.
- value
- The decimal value to convert.
戻り値: A new Price with the specified value.
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.
戻り値: true if the prices are not equal; otherwise, false.
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.
戻り値: true if is less than ; otherwise, false.
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.
戻り値: true if is less than or equal to ; otherwise, false.
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.
戻り値: The product of the two prices.
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.
戻り値: The difference of the two prices.
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.
戻り値: A new Price with the opposite sign.
public override string ToString()
result = price.ToString()
Returns a string representation of the tuple, with values separated by commas.
戻り値: A string representing the tuple's values.
public string ToString(string format, IFormatProvider formatProvider)
result = price.ToString(format, formatProvider)