public static IList ToIList(this IQueryable source)
{
if (source == null) throw new ArgumentNullException("source");
var list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(source.ElementType));
foreach (var item in source)
{
list.Add(item);
}
return list;
}