title: IsNumeric Helper Method for large numbers
body: <p>I'm trying to create a simple helper function that determines if a number is truly numeric.  Obviously it should be able to handle 'null', negative numbers, and I'm trying to do this without the help of VB's IsNumeric.  And having just learned LINQ, I thought that would be perfect.  </p>
  
  <p>The other thing I'd like is to be able to pass a string, integer, long, or any other type, so I was thinking having an 'object' as a parameter is what I really want.  Sure, I could always convert the type to string before calling the helper method, but is it <em>possible</em>?</p>
  
  <p>Here's the code I have so far and all I need to do is be able to change the parameter!  I can't imagine it wouldn't be possible... any ideas?</p>
  
  <pre><code>private static bool IsNumeric(string input)
  {
  if (input == null) throw new ArgumentNullException("input");
  if (string.IsNullOrEmpty(input)) return false;
  
  int periodCount = 0; //accept a string w/ 1dec to support values w/ a float
  
  return input.Trim()
      .ToCharArray()
      .Where(c =&gt;
      {
        if (c == '.') periodCount++;
        return Char.IsDigit(c) &amp;&amp; periodCount &lt;= 1;
      })
      .Count() == input.Trim().Length;
  }
  </code></pre>