elizondo82
Member
- Joined
- Sep 16, 2022
- Messages
- 12
- Programming Experience
- 10+
Hello, my core is 3.1, when I use the tolist() is very slow the result. How can do very fast the result?
IEnumerable<T>
. If the object data is coming from a database across the network, and there are any kinds of filtering, sorting, or grouping that needs to happen, then all that work needs to be done right at that moment.List<T>
right now in memory? Or do I just process the items of the list one at a time anyway and then discard them, in which case an IEnumerable<T>
is sufficient?"IQueryable<T>().ToList().Count
... because their architect said so and nobody was willing to question why.ToList
on. If it's an array of 10 items and that's taking a long time then that's a problem. If it's an Entity Framework query that retrieves a million records then of course it takes some time. You haven't given us any actual information about what you're doing so we have to guess. @Skydiver has probably guessed correctly but we shouldn't have to guess at all. Show us the relevant code and provide a FULL and CLEAR explanation of the problem. You say that it's slow but it almost certainly isn't. The fact that something takes a long time does not mean that it is slow, if it has a lot of work to do. You haven't given us any indication of how much work is being done in your case.