StringExtensions.AsDecimal Method

Include Protected Members
Include Inherited Members

Converts a string to a Decimal number.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

Overload List

  Name Description
Public methodStatic member AsDecimal(String) Converts a string to a Decimal number.
Public methodStatic member AsDecimal(String, Decimal) Converts a string to a Decimal number and specifies a default value.

Top

Remarks

The decimal data type is appropriate for very large numbers or for numbers that require high precision. A number of this type can be accurate (for rounding purposes) up to 29 digits. The Decimal data type is often used for financial calculations.

Use the AsDecimal methods to convert a numeric value in string format to a Decimal value. Before you try to convert, you can check whether the string can be converted to this type by calling the IsDecimal(String) method, which returns true if the string value can be converted.

See Also

Reference

StringExtensions Class

System.Web.WebPages Namespace