Mega Code Archive

 
Categories / C# / Data Types
 

Converts the string to its Decimal equivalent

using System; using System.Globalization; using System.Threading; class DecimalFieldsDemo {     public static void Main()     {         decimal number;         CultureInfo culture = Thread.CurrentThread.CurrentCulture;         try         {             number = Decimal.Parse("1.1", culture.NumberFormat);         }         catch (FormatException)         {             return;         }         catch (Exception)         {             return;         }     } }