MoneyTryParse(String, ICurrency, NumberStyles, IFormatProvider, Money) Method

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.

Definition

Namespace: InnerDrive.Financial
Assembly: InnerDrive.Financial (in InnerDrive.Financial.dll) Version: 5.2.9017.0
C#
public static bool TryParse(
	string? s,
	ICurrency? currency,
	NumberStyles style,
	IFormatProvider provider,
	out Money? result
)

Parameters

s  String
A String object containing a number to convert.
currency  ICurrency
The units of currency to use when parsing s and returning result.
style  NumberStyles
A bitwise combination of NumberStyles values that indicates the permitted format of s. A typical value to specify is Number.
provider  IFormatProvider
An IFormatProvider object that supplies culture-specific formatting information about s.
result  Money
When this method returns, contains a Money equivalent to the numeric value or symbol contained in s, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is a null reference, is not a number in a valid format, or represents a number less than MinValue or greater than MaxValue. This parameter is passed uninitialized.

Return Value

Boolean
true if s was converted successfully; otherwise; false.

Remarks

Important: This implementation assumes the result is denominated in U.S. dollars.

If s cannot be represented as a Money, result will be set to Zero.

See Also