Convert.ToString Method (Decimal)
Silverlight
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Parameters
- value
- Type: System.Decimal
A Decimal number.
This implementation is identical to Decimal.ToString.
The following code sample illustrates the conversion of a Decimal to a String, using ToString.
public void ConvertStringDecimal(string stringVal) { decimal decimalVal = 0; try { decimalVal = System.Convert.ToDecimal(stringVal); outputBlock.Text += String.Format( "The string as a decimal is {0}.", decimalVal) + "\n"; } catch (System.OverflowException) { outputBlock.Text += String.Format( "The conversion from string to decimal overflowed.") + "\n"; } catch (System.FormatException) { outputBlock.Text += String.Format( "The string is not formatted as a decimal.") + "\n"; } catch (System.ArgumentNullException) { outputBlock.Text += String.Format( "The string is null.") + "\n"; } // Decimal to string conversion will not overflow. stringVal = System.Convert.ToString(decimalVal); outputBlock.Text += String.Format( "The decimal as a string is {0}.", stringVal) + "\n"; }
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.