<pre><code>public static IList&lt;T&gt; LoadObjectListAll&lt;T&gt;()
{
    ISession session = CheckForExistingSession();
    var cfg = new NHibernate.Cfg.Configuration().Configure();
    var returnList = session.CreateCriteria(typeof(T));
    var list = returnList.List();
    var castList = list.Cast&lt;typeof(T)&gt;();
    return castList;
}
</code></pre>

<p>So, I'm getting a build error where I am casting the "list" element to a generic IList .... can anyone see a glaring error here? </p>

I think
```
```
var castList = list.Cast<typeof(T)>();
```
```
should be
```
```
var castList = list.Cast<T>();
```
```
@Jon Limjap The most glaring error I can see is
  that an
```
IList
```
is definitely different from an
```
IList<T>
```
. An
```
IList
```
is non-generic
  (e.g.,
```
ArrayList
```
).
The original question was already using an
```
IList<T>
```
. It was removed when someone edited the formatting. Probably a problem with Markdown.
Fixed now.