title: How to do this in c# using generics
body: <p>I have a code similar to this:</p>
  <pre><code> int GetIntValue(string name)
   {
        string valueString=GetValue(name);
        int value=int.Parse(valueString);
        return value;
   }
   double GetDoubleValue(string name)
   {
        string valueString=GetValue(name);
        double value=double.Parse( valueString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture);
        return value;
   }
  </code></pre>
  <p>and similar code for other type of numeric type.</p>
  <p>I want to write something such as this:</p>
  <pre><code>  T getValue&lt;T&gt;(string name)
    {
        string valueString=GetValue(name);
        T value=T.Parse(valueString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture);
        return value;
    }
  </code></pre>
  <p>But it is not working (T is too general). How can  change this code to do use generic in c#?</p>
  <p>I am using .net 4.</p>
  <h1>edit</h1>
  <p>Code fixed to remove typos.</p>