title: Why do generic extension methods get called with the parent type from the parent?
body: <p>Consider the following code:</p>
  
  <pre><code>public static class ParentHelper {
     public static string GetTypeString&lt;T&gt;(this T parent) where T : Parent {
        return typeof(T).ToString();
     }
  }
  
  public abstract class Parent {
     public string GetMyType(bool withReflection) {
        return withReflection
           ? typeof(ParentHelper)
              .GetMethod("GetTypeString")
              .MakeGenericMethod(GetType()).Invoke(null, new object[] { this }) as string
           : this.GetTypeString();
     }
  }
  
  public class Child : Parent {
  }
  
  void Main() {
     Child child = new Child();
     child.GetMyType(false).Dump();            // Parent
     ((Parent) child).GetMyType(false).Dump(); // Parent
     child.GetMyType(true).Dump();             // Child
     ((Parent) child).GetMyType(true).Dump();  // Child
  }
  </code></pre>
  
  <p>To my surprise, The <code>GetMyType</code> method returns different values depending on how it calls <code>GetTypeString</code> (see comments in <code>Main</code> method).</p>
  
  <p>Is there any way for the <code>GetTypeString</code> extension method to work with the <em>child</em> class type instead of the parent one, when using the normal <code>object.ExtensionMethod()</code> syntax?</p>
  
  <p>Note that this code is the minimum example I could put together--my usage is quite different (not returning the type, but rather an attribute decorating the child class).</p>