Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How change List<T> data to IQueryable<T> data [duplicate]

Tags:

.net

linq

People also ask

Is IQueryable faster than list?

GetList(context) might return an object backed by a custom LINQ provider (like an Entity Framework collection), then you probably want to leave the data cast as an IQueryable: even though your benchmark shows it being 20 times faster to use a list, that difference is so small that no user is ever going to be able to ...

How do I add data to IQueryable?

The simple answer is that unless you add the record to the underlying datastore that the Iqueryable is querying, you can't add a new record into an IQueryable. So if you are using LinqToSql then you would have to add a row into the table that the IQueryable was querying in order to "add" a row into the IQueryable.

How do you add two IQueryable results?

var list4 = list1. Union(list2); Union is a set operation - it returns distinct values. Concat simply returns the items from the first sequence followed by the items from the second sequence; the resulting sequence can include duplicate items.

What is IQueryable return?

IQueryable is executed. // // Returns: // A System.Type that represents the type of the element(s) that are returned when. // the expression tree associated with this object is executed.


var list = new List<string>();
var queryable = list.AsQueryable();

Add a reference to: System.Linq