Money Structure

Represents a value of money in a particular unit of currency.

Definition

Namespace: InnerDrive.Financial
Assembly: InnerDrive.Financial (in InnerDrive.Financial.dll) Version: 5.2.9417.0
C#
[SerializableAttribute]
[JsonConverterAttribute(typeof(MoneyJsonConverterNewtonsoft))]
[JsonConverterAttribute(typeof(MoneyJsonConverterSystem))]
public readonly struct Money : IAdditionOperators<Money, Money, Money>, 
	IAdditionOperators<Money, decimal, Money>, IAdditionOperators<Money, int, Money>, 
	ICloneable, IComparable, IComparable<Money>, IComparisonOperators<Money, Money, bool>, 
	IEqualityOperators<Money, Money, bool>, IConvertible, IDivisionOperators<Money, decimal, Money>, 
	IDivisionOperators<Money, int, Money>, IEquatable<Money>, 
	IMinMaxValue<Money>, IModulusOperators<Money, decimal, Money>, 
	IMultiplyOperators<Money, decimal, Money>, IMultiplyOperators<Money, int, Money>, 
	ISubtractionOperators<Money, Money, Money>, ISubtractionOperators<Money, decimal, Money>, 
	ISubtractionOperators<Money, int, Money>, IUnaryNegationOperators<Money, Money>, 
	ISpanFormattable, IFormattable
Inheritance
Object    ValueType    Money
Implements
ICloneable, IComparable, IComparableMoney, IConvertible, IEquatableMoney, IFormattable, ISpanFormattable, IAdditionOperatorsMoney, Money, Money, IAdditionOperatorsMoney, Decimal, Money, IAdditionOperatorsMoney, Int32, Money, IComparisonOperatorsMoney, Money, Boolean, IDivisionOperatorsMoney, Decimal, Money, IDivisionOperatorsMoney, Int32, Money, IEqualityOperatorsMoney, Money, Boolean, IMinMaxValueMoney, IModulusOperatorsMoney, Decimal, Money, IMultiplyOperatorsMoney, Decimal, Money, IMultiplyOperatorsMoney, Int32, Money, ISubtractionOperatorsMoney, Money, Money, ISubtractionOperatorsMoney, Decimal, Money, ISubtractionOperatorsMoney, Int32, Money, IUnaryNegationOperatorsMoney, Money

Remarks

Constructors

Money(Decimal) Creates a new instance of Money denominated in U.S. dollars.
Money(Decimal, ICurrency) Creates a new instance of Money denominated in a particular ICurrency.
Money(Decimal, ICurrency, IRoundingStrategy) Creates a new instance of Money denominated in a particular ICurrency.

Properties

Currency Gets the currency used by this instance.
MaxValue Returns the largest possible value for Money.
MinValue Returns the smallest possible value for Money.
RoundingStrategy Gets or sets the currently-used rounding strategy.
Value Gets the value of this instance.

Methods

Add Adds two instances of Money together.
Allocate(IListDecimal) Allocates the money value proportionately according to the list of values supplied using the Money object's current rounding strategy.
Allocate(Int32)There are two overloads. Allocates the money value into an equal number of shares using the instance rounding strategy.
Clone Creates a new object that is a copy of the current instance.
CompareTo Compares the current instance with another Money.
ConvertTo Converts this instance from its currency into another currency.
Divide Divides an instances of Money by a decimal value.
Equals(Money) Indicates whether the current object is equal to another object of the same type.
Equals(Object) Determines whether the specified Object is equal to this instance of Money.
(Overrides ValueTypeEquals(Object))
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCode Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
(Overrides ValueTypeGetHashCode)
GetTypeGets the Type of the current instance.
(Inherited from Object)
GetTypeCodeReturns the TypeCode for this instance.
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Mod The modulus operator computes the remainder after dividing its first (Money) operand by its second (Decimal).
Multiply Multiplies an instances of Money by a decimal value.
Negate Negates the value of the specified Money operand.
Parse(String) Converts the String representation of a number to its Money equivalent in U.S. dollars.
Parse(String, ICurrency) Converts the String representation of a number to its Money equivalent using a specific currency unit.
RoundThere are four overloads. Rounds the instance internal value to the smallest fractional unit of the instance's currency.
Round(Int32) Rounds the instance internal value to the smallest fractional unit of the instance's currency to a specified number of decimal places.
Round(IRoundingStrategy) Rounds the instance internal value to the smallest fractional unit of the instance's currency using a specific rounding strategy.
Round(IRoundingStrategy, Int32) Rounds the instance internal value to the smallest fractional unit of the instance's currency, to a specified number of decimal places, using a specific rounding strategy.
Subtract Subtracts one instances of Money from another.
ToBooleanConverts the value of this instance to an equivalent Boolean value using the specified culture-specific formatting information.
ToByteConverts the value of this instance to an equivalent 8-bit unsigned integer using the specified culture-specific formatting information.
ToCharConverts the value of this instance to an equivalent Unicode character using the specified culture-specific formatting information.
ToDateTimeConverts the value of this instance to an equivalent DateTime using the specified culture-specific formatting information.
ToDecimalConverts the value of this instance to an equivalent Decimal number using the specified culture-specific formatting information.
ToDoubleConverts the value of this instance to an equivalent double-precision floating-point number using the specified culture-specific formatting information.
ToExponentString(Int32, String) Displays this Money value as an exponent
ToExponentString(IFormatProvider, Int32, String) Displays this Money value as an exponent
ToInt16Converts the value of this instance to an equivalent 16-bit signed integer using the specified culture-specific formatting information.
ToInt32Converts the value of this instance to an equivalent 32-bit signed integer using the specified culture-specific formatting information.
ToInt64Converts the value of this instance to an equivalent 64-bit signed integer using the specified culture-specific formatting information.
ToSByteConverts the value of this instance to an equivalent 8-bit signed integer using the specified culture-specific formatting information.
ToSingleConverts the value of this instance to an equivalent single-precision floating-point number using the specified culture-specific formatting information.
ToStringThere are four overloads. Converts the numeric value of this instance to its equivalent String representation.
(Overrides ValueTypeToString)
ToString(IFormatProvider) Converts the numeric value of this instance to its equivalent String representation.
ToString(String) Converts the numeric value of this instance to its equivalent String representation.
ToString(String, IFormatProvider) Converts the numeric value of this instance to its equivalent String representation.
ToTypeConverts the value of this instance to an Object of the specified Type that has an equivalent value, using the specified culture-specific formatting information.
ToUInt16Converts the value of this instance to an equivalent 16-bit unsigned integer using the specified culture-specific formatting information.
ToUInt32Converts the value of this instance to an equivalent 32-bit unsigned integer using the specified culture-specific formatting information.
ToUInt64Converts the value of this instance to an equivalent 64-bit unsigned integer using the specified culture-specific formatting information.
TryFormatTries to format the value of the current instance into the provided span of characters.
TryParse(String, Money) Converts the String representation of a number to its Money equivalent. A return value indicates whether the conversion succeeded or failed.
TryParse(String, ICurrency, Money) Converts the String representation of a number to its Money equivalent. A return value indicates whether the conversion succeeded or failed.
TryParse(String, ICurrency, NumberStyles, IFormatProvider, Money) Converts the String representation of a number to its Money equivalent using the specified style and culture-specific format. A return value indicates whether the conversion succeeded or failed.

Operators

Addition(Money, Money)Adds two values together to compute their sum.
Addition(Money, Decimal)Adds two values together to compute their sum.
Addition(Money, Int32)Adds two values together to compute their sum.
Division(Money, Decimal)Divides one value by another to compute their quotient.
Division(Money, Int32)Divides one value by another to compute their quotient.
Equality(Money, Money)Compares two values to determine equality.
GreaterThan(Money, Money)Compares two values to determine which is greater.
GreaterThanOrEqual(Money, Money)Compares two values to determine which is greater or equal.
(Decimal to Money) Creates a new Money object from a Decimal value.
(Double to Money) Creates a new Money object from a Double value.
(Money to Decimal) Creates a new Decimal value from a given Money object.
(Money to Double) Creates a new Double value from a given Money object.
Inequality(Money, Money)Compares two values to determine inequality.
LessThan(Money, Money)Compares two values to determine which is less.
LessThanOrEqual(Money, Money)Compares two values to determine which is less or equal.
Modulus(Money, Decimal) The modulus operator computes the remainder after dividing its first (Money) operand by its second (Decimal).
Multiply(Money, Decimal)Multiplies two values together to compute their product.
Multiply(Money, Int32)Multiplies two values together to compute their product.
Subtraction(Money, Money)Subtracts two values to compute their difference.
Subtraction(Money, Decimal)Subtracts two values to compute their difference.
Subtraction(Money, Int32)Subtracts two values to compute their difference.
UnaryNegation(Money)Computes the unary negation of a value.

Fields

Zero Gets a Money object with a value equal to zero, denominated in the default currency.

Explicit Interface Implementations

IComparableCompareTo Compares the current instance with another object of the same type.

See Also