title: How does generic type inference work in C#?
body: <p>If I have the following code</p>
  
  <pre><code>private BaseMessage getMessage()
  {
      return new OtherMessage();
  }
  
  private void CheckType&lt;T&gt;(T type)
  {
      Console.WriteLine(type.GetType().ToString());
      Console.WriteLine(typeof(T).ToString());
  }
  
  private void DoChecks()
  {
       BaseMessage mess = getMessage();
       CheckType(mess);
  }
  </code></pre>
  
  <p>why do I get different types outputted? Is there anyway of getting the type inference to use the actual type of the object being passed?</p>