Originally posted by monkeyking
no, I don't think that's soluction, even I include System.Collections.Generic, it still doesn't have 'ToList()' method.
|
You need to reference the System.Core assembly in your project, and add using statements for System.Linq and System.Collections.Generic to your code file.
ToList() is required by the IEnumerable<T> interface (which is defined in System.Collections.Generic); therefore, any type that implements IEnumerable<T> will have an implementation of ToList(). This is true of our EntityQuery<T>. However, as you apply extension methods to a query, most such methods return a new query (using the prior one as input), and sometimes the return type can change. But anything that's an IEnumerable<T> (this includes EntityQuery<T>, IEntityQuery<T>, and IQueryable<T>) should provide ToList().
Note that under certain circumstances you can get the non-generic IEnumerable instead of IEnumerable<T>. In those cases you may be able to call the Cast() method on the IEnumerable to cast it to an IEnumerable<T>, which will have ToList().