3 ms·
> I'm saying that loops are usually a terrible solution, but LINQ has a way of essentially hiding those egregious violators So when you want to sort, search or
by SideburnsOfDoom 14y ago
> I'm saying that loops are usually a terrible solution, but LINQ has a way of essentially hiding those egregious violators
So when you want to sort, search or transform a list, you prefer a technique which doesn't iterate over the items in the list at all? That makes no sense.
- corresation 14y agoI prefer a technique where algorithms and computer science come into play. e.g. dictionaries, hashes, binary trees, structured data based upon the actual uses, etc. Having a giant array of memory objects and then treating every bit of code like it's some edge condition is not appropriate.
- SideburnsOfDoom 14y agoI agree that Dictionaries and the like are under-used. But I don't agree that LINQ is bad because someone on your team didn't know how to use a Dictionary and thought that iteration would be fast on large in-memory lists. In many cases there are efficient LINQ constructs, e.g lazy lists, and First() not enumerating past the matching item. Hand-coding these is prone to doing it worse than Linq would. Teach your team how to use .ToDictionary() if need be.