title: How to find out the type of list items and then create a list of that type of items?
body: <p>I'm trying to use a generic <code>List&lt;T&gt;</code> custom class <code>MyList&lt;T&gt;</code> for automated items parsing and I'm stuck at creating a return type of <code>MyList&lt;T&gt;</code>. Specifically I don't know how to create such a list with the given type. One thing I can do is find out the type and store it in a <code>Type itemType</code> variable.</p>
  
  <p><a href="https://stackoverflow.com/questions/557340/c-sharp-generic-list-t-how-to-get-the-type-of-t">This question</a> helped me find out the type of list items.</p>
  
  <p>The catch is I don't know the list type until runtime, so it can't be written explicitly in code.</p>
  
  <p>How do I create a list of items of a certain type using a <code>Type itemType</code> variable?</p>