title: Checking if a variable is of data type double
body: <p>I need to check if a variable I have is of the data type <code>double</code>. This is what I tried:</p>
  
  <pre><code>try
  {
      double price = Convert.ToDouble(txtPrice.Text);
  }
  catch (FormatException)
  {
      MessageBox.Show("Product price is not a valid price", "Product price error", MessageBoxButtons.OK, MessageBoxIcon.Error);
      return false;
  }
  </code></pre>
  
  <p>I thought this would work, but obviously, I failed to realize if <code>txtPrice.Text</code> had anything other than a number in it, the <code>Convert</code> class will just parse it out.</p>
  
  <p>How can I realiably check if a variable is a double?</p>