pass a generic type to a method
<p>I want to write a generic function that passes a generic parameter to a function that has several overloads. The C++ equivalent would be <a href="https://ideone.com/3OsmvD" rel="nofollow">this</a>. Here is what I tried:</p>

<pre><code>public void setUniform1&lt;T&gt;(int loc, T value) {
    GL.Uniform1(loc, value);
}
</code></pre>

<p>However this gives me the error</p>

<blockquote>
  <p>error CS1503: Argument 2: cannot convert from 'T' to 'double'</p>
</blockquote>

<p><code>GL.Uniform1</code> takes several types for the value paramter and I guess double is the first overload, that's why it's trying to convert to double.</p>

<p>So how do I do this?</p>