Use TryParse to Convert string to double
using System;
class MainClass{
public static void Main(){
string value;
double number;
// Parse a floating-point value with a thousands separator.
value = "1,234.56";
if (Double.TryParse(value, out number))
Console.WriteLine(number);
else
Console.WriteLine("Unable to parse '{0}'.", value);
}
}
Related examples in the same category