# Converts string to decimal. A return value indicates whether the conversion succeeded or failed. : decimal « Data Types « C# / C Sharp

Home
C# / C Sharp
 1 2D Graphics 2 Class Interface 3 Collections Data Structure 4 Components 5 Data Types 6 Database ADO.net 7 Date Time 8 Design Patterns 9 Development Class 10 Event 11 File Stream 12 Generics 13 GUI Windows Form 14 Internationalization I18N 15 Language Basics 16 LINQ 17 Network 18 Office 19 Reflection 20 Regular Expressions 21 Security 22 Services Event 23 Thread 24 Web Services 25 Windows 26 Windows Presentation Foundation 27 XML 28 XML LINQ
 C# / C Sharp » Data Types » decimal Screenshots
Converts string to decimal. A return value indicates whether the conversion succeeded or failed.
 ```  using System; class MainClass {     public static void Main( )     {         string value;         decimal number;                  // Parse a floating-point value with a thousands separator.         value = "1,234.56";         if (Decimal.TryParse(value, out number))            Console.WriteLine(number);         else            Console.WriteLine("Unable to parse '{0}'.", value);           } }       ```
Related examples in the same category
 1 Compute the regular payments for a loan 2 Using Decimals 3 Use the decimal type to compute a discount. 4 Use the decimal type to compute the future value of an investment 5 Compute the initial investment needed to attain a known future value given 6 Manually create a decimal number 7 decimal property 8 explicit conversions from decimal to int 9 Convert decimal to integer 10 Parse string using "\$" as the currency symbol for en-GB and en-us cultures. 11 Rounds a Decimal value to a specified number of decimal places. 12 Decimal.ToDouble 13 Converts Decimal to the equivalent 8-bit unsigned integer. 14 Parse string using "." as the thousands separator and " " as the decimal separator. 15 Converts string to Decimal using the specified style and culture-specific format. 16 Decimal.MinValue Field: represents the smallest possible value of Decimal. 17 Converts the string to its Decimal equivalent 18 Create decimal number from double 19 Decimal.Ceiling Method 20 Returns the TypeCode for value type Decimal. 21 Decimal.ToInt16 22 Converts Decimal to the equivalent 32-bit signed integer. 23 Converts the value of the specified Decimal to the equivalent 64-bit signed integer. 24 Converts Decimal to OLE Automation Currency value 25 Converts Decimal to the equivalent 8-bit signed integer. 26 Converts Decimal to the equivalent single-precision floating-point number. 27 Converts Decimal to string using the specified culture-specific format information. 28 Converts decimal to string using standard format and culture 29 Converts decimal to string to ToString method and format 30 Converts Decimal to the 16-bit unsigned integer. 31 Converts Decimal to the 32-bit unsigned integer. 32 Converts Decimal to 64-bit unsigned integer. 33 Parse currency value using en-GB culture. 34 Parse a string to decimal with NumberStyles.AllowDecimalPoint 35 Parse a string to decimal with NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands 36 Decimal fields: Zero, MinValue, MaxValue, One 37 Converts a Decimal to an 8-bit unsigned integer.