title: Generic function which contains T.TryParse(x, out y)?
body: <p>There are several functions which are almost the same (or the different part can easily to be implemented using type parameters). However, one difference each functions call different <code>TryParse()</code> functions.</p>
  
  <pre><code>void Fun1&lt;T&gt;(T p) where T : IBase // simplified
  { ...... 
      int x;
      if(int.TryParse(p.S, out x)) { .... }
  }
  
  void Fun1&lt;T&gt;(T p) where T : IBase
  { ...... 
      decimal x;
      if(decimal.TryParse(p.S, out x)) { .... }
  }
  ......
  </code></pre>
  
  <p>How to create a generic method with a type parameter for int, decimal, double, short, ... (any type with method <code>TryParse</code>) for these functions?</p>