WPF Datagrid.ItemsSource as List<Anything> and use on Linq
<p>I'm searching more than 10 hours.</p>

<p>There are 10 classes and 1 datagrid in other window</p>

<pre><code>datagrid1.ItemsSource = new List&lt;class1&gt;(); //+100 items in list
or
datagrid1.ItemsSource = new List&lt;class2&gt;(); //+100 items in list
or
datagrid1.ItemsSource = new List&lt;class3&gt;(); //+100 items in list
</code></pre>

<p>I need to convert and use the return items in Linq:</p>

<pre><code>var items = datagrid1.ItemsSource as List&lt;???&gt;;
datagrid1.ItemsSource = items.Where(a =&gt; a.GetType().GetProperty("Name").GetValue(a, null).ToString().Contains("text"));
</code></pre>

<p>I'm using these. but not work</p>

<pre><code>using System.Linq;

var items = datagrid1.ItemsSource as IList;
//Error CS1061  'IList' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'IList' could be found (are you missing a using directive or an assembly reference?)

var items = datagrid1.ItemsSource as List&lt;dynamic&gt;; // return null
var items = datagrid1.ItemsSource as List&lt;object&gt;; // return null
</code></pre>

<p>what things I should use instead ??? for support Linq?</p>

<p>Note: I wont use class1 or class2 or class3</p>