Need to Convert List<T> to List<someClass> and Back
<p>I have a generic list assigned to a var <code>data</code>. The type of this list depends on previous code, and I need to return the generic type from the controller. It seems that I cannot have outside methods that <a href="https://stackoverflow.com/questions/1937301/how-to-return-a-generic-list-collection-in-c">take a generic List</a>. </p>

<pre><code>List&lt;T&gt; data = await queriedItems
        .Project(x =&gt; Mapper.Map&lt;BsonDocument, T&gt;(x)).ToListAsync();

if (data.GetType() == typeof(List&lt;SomeClass&gt;))
{
    data = someHelper.HelperMethodChangeData(data);
}
</code></pre>

<p>How do I handle this? I was thinking of creating a new <code>List&lt;SomeClass&gt;</code> var and then somehow converting it over <code>data</code> to that class, passing the specific type List type to my method, and then converting that back to a generic, if that's even possible. I don't think this matters, but the helper just takes a subset of the items in the List. </p>

<p>Edit - adding helper signature attempt to take generic:</p>

<pre><code>public List&lt;T&gt; HelperMethodSignature&lt;T&gt;(List&lt;T&gt; itemsList)
</code></pre>

<p>Edit - and the original helper signature below:</p>

<pre><code>public List&lt;someClass&gt; HelperMethodSignature(List&lt;someClass&gt; itemsList)
</code></pre>

<p>I excluded a bunch of irrelevant params. </p>