title: Is there a way to constrain a generic parameter type to the type of a certain property?
body: <p>Please consider the following code:</p>
  <pre><code>public class User 
  {
    public String Id {get; set;}
  }
  
  public interface IUserService 
  {
    bool IsAdmin(string userId);
  }
  </code></pre>
  <p>I would like to not specify the type of the <code>userId</code> parameter in the interface but rather use a generic type that is constrained to be of the same type as the property <code>Id</code> in the class <code>User</code> so that I don't have to change the code if I eventually decide to change the type of the property.
  So what I have in mind is something like:</p>
  <pre><code>public interface IUserService 
  {
    bool IsAdmin&lt;T&gt;(T userId) where T : typeof(User.String)
  }
  </code></pre>
  <p>Is that possible?</p>