NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

String.ToDecimal

Converts a string to a Decimal.

[Visual Basic]
Overridable Public Function ToDecimal() As Decimal
[C#]
public virtual Decimal ToDecimal();
[C++]
public: virtual Decimal ToDecimal();
[JScript]
public function ToDecimal() : Decimal;

Return Value

The Decimal with the value represented by value.

Exceptions

Exception Type Condition
ArgumentException If the string is null.
FormatException If the string does not contain a representation that can be converted to a Decimal using the Parse(String) method implemented by that type.
OverflowException If the string represents a number that is less than Decimal.MaxValue or greater than Decimal.MinValue.

Remarks

The ToDecimal implementation is the same as Parse and ToDecimal. (In addition information, see Decimal, Convert and Value.)

Note that if the beginning of the string contains a properly formatted numerical value, that will result in an overflow. In addition, the end of the string is improperly formed, it cannot be determined whether an OverflowException or a FormatException will be thrown. This has been implemented this way for performance reasons.

See Also

String Class | String Members | System Namespace