score:2

Accepted answer

The difference between IQueryable and IQueryable<T> is that the second is typed while the first is not. To convert IQueryable into IQueryable<T> you can use the Cast<T>() method.

IQueryable myQueryable = ...;
IQueryable<MyType> myTypedQueryable = myQueryable.Cast<myQueryable>();
IList<MyType> myList = myTypedQueryable.ToList();

Obviously the contents of myQyeryable must be castable into MyType. To select the instances of a certain type you can use the TypeOf<T>() method before doing the cast.


Related Articles