title: Specify one generic parameter, infer the rest?
body: <p>I have an interface, which is use by repositories) that with this member:</p>
  
  <pre><code>T FindById&lt;T, TId&gt;(TId id)
      where T : class, IEntity&lt;TId&gt;
      where TId : IEquatable&lt;TId&gt;;
  </code></pre>
  
  <p>This allows the caller to specify an entity type (<code>T</code>) and the type of it's <code>Id</code> field (<code>TId</code>). The implementor of this interface would then find the entities of type <code>T</code> and use the <code>id</code> parameter to filter them according to their id (which is defined on <code>IEntity&lt;TId&gt;</code>).</p>
  
  <p>Currently I'm calling it like this:</p>
  
  <pre><code>int id = 123;
  var myApproval = PartsDC.FindById&lt;Approval, int&gt;(id);
  </code></pre>
  
  <p>Ideally I'd like to do this:</p>
  
  <pre><code>int id = 123;
  var myApproval = PartsDC.FindById&lt;Approval&gt;(id);
  </code></pre>
  
  <p>I figure the 2nd generic parameter should be able to be inferred by the fact that <code>id</code> is an <code>int</code> (so that's what my 2nd generic parameter is).</p>
  
  <p>Is it possible to get anything like this, where I don't have to specify the type of the id field in my class?</p>