title: What is the parameter type for a generic function parameter when called from a base class with 'this'?
body: <p>Confusing question, I know.  Given the following:</p>
  
  <pre><code>    class Test
      {
          public static void GenericFunc&lt;T&gt;(T SomeType)
          {
              System.Console.WriteLine("typeof(T): " + typeof(T).Name);
              System.Console.WriteLine("SomeType.GetType(): " + SomeType.GetType().Name);
          }
      }
  
      public class BaseType
      {
          public void RunTest() { Test.GenericFunc(this); }
      }
  
      public class DerivedType : BaseType { }
  </code></pre>
  
  <p>The following code produces interesting output:</p>
  
  <pre><code>    DerivedType Derived = new DerivedType();
      Derived.RunTest();
  
      // output:
      // typeof(T): BaseType
      // SomeType.GetType(): DerivedType
  </code></pre>
  
  <p>However, this behaves as I would expect:</p>
  
  <pre><code>    Test.GenericFunc(new Derived());
  
      // output:
      // typeof(T): DerivedType
      // SomeType.GetType(): DerivedType
  </code></pre>
  
  <p>Can anyone help me understand the mechanism here that's causing T to be evaluated as BaseType in the first case?</p>
  
  <p>Thanks in advance!</p>