title: How to distinguish between enclosing and nested type parameters using Reflection in .NET?
body: <p>When I have a nested type like this:</p>
  
  <pre><code>public class MyOuter&lt;T&gt;
  {
      public class MyInner { }
  }
  </code></pre>
  
  <p>How do I tell, using Reflection on <code>typeof(MyInner&lt;int&gt;)</code> that the type parameter <code>T</code> is declared on <code>MyOuter</code> and not on <code>MyInner</code> ? When I call <code>typeof(MyOuter&lt;int&gt;.MyInner).GetGenericArguments()</code> it returns an array with <code>typeof(int)</code> and so does <code>typeof(MyOuter&lt;int&gt;).GetGenericArguments()</code>.</p>