c# - IQueryable to List - Stack Overflow
stackoverflow.com › questions › 25453212Oct 22, 2014 · If I have an IQueryable<T> I can simply do a .ToList() to convert it into a list and force the query to actually run on the database, but with the non-generic IQueryable, that method doesn't exists. This is because ToList is inherited from IEnumerable<T> which IQueryable<T> inherits and IQueryable , obviously, doesn't.
entity framework - How to convert IQueryable type to a list ...
stackoverflow.com › questions › 60134494Feb 9, 2020 · How to convert IQueryable type to a list view model. I'm working on an ASP.NET Core MVC project. In one of my controller class in its Details method, I have written code like this: public async Task<IActionResult> Details (int? id) { IQueryable query = Enumerable.Empty<Applicant ().AsQueryable (); if (id == null) { return NotFound (); } var applicant = await _context.Applicant .Include (a => a.ApplicantTypeNavigation) .FirstOrDefaultAsync (m => m.ApplicantId == id); if (applicant.