Ali Nafees Ali Nafees - 7 months ago 29
reST (reStructuredText) Question

Data without using .ToList is also send to api, but how?

In web api the data without using

is also send to api, but how?
This is my LINQ query and I do not use the
but my data is also sent to the browser.can anyone please tell me the difference or can describe that how it is working?

using (var _context = new iCMEFModelCon())
return _context.UserResidents.Where(c => c.ResidentId == residentId)
.Select(c => new
UserId = c.User.Id,
UserName = ((c.User.FirstName ?? "") + " " + (c.User.LastName ?? "")).Trim()

Answer Source

The return type of the query is either IEnumerable or IQueryable:

The result of a Linq database query is typically IQueryable< T> which is derived from IEnumerable< T>, IQueryable, and IEnumerable.

If your data source is an IEnumerable, the result type isIEnumerable< T>

Find More

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download