c# convert string to double code example
Example 1: convert int to double c#
int x = 420;
double y = Convert.ToDouble(x);
Example 2: c# string to float
class Program
{
static void Main(string[] args)
{
string str1 = "5.682";
string str2 = "4.137";
float flt1 = float.Parse(str1);
float flt2 = float.Parse(str2);
Console.WriteLine(flt1 + flt2);
Console.ReadLine();
}
}
Example 3: convert string to double c#
Console.WriteLine(Convert.ToDouble("104.1169"));
Example 4: c# convert double to string
Double result = "12345.6789";
print(result.ToString("r"));