Use a parameter System.Type T in List<T> <p>Suppose I have a function:</p> <pre><code>public static IList GetAllItems(System.Type T) { XmlSerializer deSerializer = new XmlSerializer(T); TextReader tr = new StreamReader(GetPathBasedOnType(T)); IList items = (IList) deSerializer.Deserialize(tr); tr.Close(); return items; } </code></pre> <p>In order to retrieve a list of Articles, I would like to call <code>GetAllItems(typeof(Article))</code> instead of <code>GetAllItems(typeof(List&lt;Article&gt;))</code> but still return a list.</p> <p><strong>Question</strong>: how can I, <strong>without changing the function declaration/prototype</strong>, avoid requiring unnecessary <code>List&lt;&gt;</code> portion when calling this function?</p> <p>That is, I am looking for something like this:</p> <pre><code>public static IList GetAllItems(System.Type T) { /* DOES NOT WORK: Note new List&lt;T&gt; that I want to have */ XmlSerializer deSerializer = new XmlSerializer(List&lt;T&gt;); TextReader tr = new StreamReader(GetPathBasedOnType(T)); IList items = (IList) deSerializer.Deserialize(tr); tr.Close(); return items; } </code></pre>