title: Checking if an object is a number in C#
body: <p>I'd like to check if an object is a number so that <code>.ToString()</code> would result in a string containing digits and <code>+</code>,<code>-</code>,<code>.</code></p>
  
  <p>Is it possible by simple type checking in .net (like: <code>if (p is Number)</code>)?</p>
  
  <p>Or Should I convert to string, then try parsing to double?</p>
  
  <p><strong>Update:</strong> To clarify my object is int, uint, float, double, and so on it isn't a string.
  I'm trying to make a function that would serialize any object to xml like this:</p>
  
  <pre><code>&lt;string&gt;content&lt;/string&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;numeric&gt;123.3&lt;/numeric&gt;
  </code></pre>
  
  <p>or raise an exception.</p>