title: c# overload resolution between generic and non-generic methods
body: <p>I did some basic search on internet and stackoverflow and I saw quite a lot discussion around overload resolution when both generic version method and non-generic version method are involved. I understand that the overload reslolution is done in compile time - therefore if I have this code:</p>
  
  <pre><code>public class A&lt;T&gt;
  {
      public void DoStuff(T value)
      {
           InternalDoStuff(value);
      }
  
      protected void InternalDoStuff(int value)
      {
           Console.WriteLine("Non-generic version");
      }
  
      protected void InternalDoStuff(T value)
      {
           Console.WriteLine("Generic version");
      }
  
  }
  
  public class Test
  {
      static void Main (string [] args)
      {
           A&lt;int&gt; a = new A&lt;int&gt; ();
           a.DoStuff(100);
      }
  }
  </code></pre>
  
  <p>The output will be "Generic version" because the resolution of "InternalDoStuff" has been sorted out by compiler and what compiler sees is "InternalDoStuff is called with a T type parameter in DoStuff".</p>
  
  <p>However I dont know if this will make any difference:</p>
  
  <pre><code>public class B : A &lt;int&gt; 
  {
  
  }
  
  public class Test
  {
      static void Main (string [] args)
      {
           B b = new B ();
           b.DoStuff(100);
      }
  }
  </code></pre>
  
  <p>Now can I say that compiler has enough information to decide "B is a specific version of A", therefore invoke the non-generic version of InternalDoStuff?</p>
  
  <p>Is there any general principle to analyze these kind of overload resolution?</p>