Check if var is a List of any kind of objects
<p>I'm developing an application with .NET Framework 4.6.1 and C#.</p>

<p>I want to do this:</p>

<pre><code>var val = actionArguments[key];
if (val is List&lt;T&gt; as class)
</code></pre>

<p>I want to check if <code>val</code> is a <code>List</code> of any kind of object but that statement doesn't compile.</p>

<p>How can I check if a variable declared as var is a List?</p>

<p>On my application var is <code>List&lt;Code&gt;</code>. <code>Code</code> is a custom class that I made. And <code>List</code> is <code>System.Generic.Collections</code>.</p>