title: Passing generic type as generic type parameter to the generic method
body: <p>Here is original code</p>
  <pre class="lang-cs prettyprint-override"><code>private static void PassGeneric(Type repositoryType)
  {
      // this can be a loop where mt is changing with every iteration
      Type[] typeArgs = { mt }; // mt retrieved using some logic
      Type typedRepositoryImplementation = repositoryType.MakeGenericType(typeArgs);
  }
  </code></pre>
  <p>Trying to make it better</p>
  <pre class="lang-cs prettyprint-override"><code>private static void PassGeneric&lt;TRepository, TModel&gt;()
      where TRepository : IRepository&lt;TModel&gt; where TModel : class
  {
  
      Type[] typeArgs = { mt }; 
      Type repositoryType = typeof(TDataRepository)
      Type typedRepositoryImplementation = repositoryType.MakeGenericType(typeArgs);
  
  }
  
  </code></pre>
  <p>With the second version I need now to do this - instead of obtaining the list of types inside the method, I need a wrapping method in which I will iterate</p>
  <pre class="lang-cs prettyprint-override"><code>private static void PassGeneric&lt;TRepository, TModel&gt;()
  { . . . . . }
  
  private static void IterateGeneric()
  {
      IEnumerable&lt;(Type, Type)&gt; typeList = GetList();
      foreach(var t in typeList)
      {
  
          PassGeneric&lt;??, ??&gt;() &lt;-- I am glitching right here
      }   
  }
  
  </code></pre>
  <p>I am going into wrong direction with this? Should I stick to <code>PassGeneric(Type repositoryType)</code>?</p>