Creating empty IQueryable list

c#, entity-framework

Solution

You could use something like this

 IQueryable<VirtualMachine> vm2 = new VirtualMachine[] {}.AsQueryable();

Do you actually want / need this though? as on MSDN, the IQueryable interface is for use on data sources.

Provides functionality to evaluate queries against a specific data source wherein the type of the data is known.

I would decide whether or not you actually need this before implementing it like this.

Problem

I want to create a list of empty IQueryable and change it to ToPagedList, I tried the following code :- ``` IQueryable<VirtualMachine> vm2 = new IQueryable<VirtualMachine>(); vm2.ToPagedList(page, pagesize); ``` but it will raise the following exception:- Error 3 A new expression requires (), [], or {} after type

Original source

Related problems