I need to check if a variable I have is of the data type double. This is what I tried:
double
try { double price = Convert.ToDouble(txtPrice.Text); } c
Use the Double.TryParse method:
double price; if (Double.TryParse(txtPrice.Text, out price)) { Console.WriteLine(price); } else { Console.WriteLine("Not a double!"); }