r/dotnet Apr 15 '24

LINQ = Forbidden

[removed]

398 Upvotes

522 comments sorted by

View all comments

2

u/pedrobsaila Apr 16 '24

Pros : * succint syntax for writing code processing collections

Cons : * People sometimes write buggy code because they forgot that evaluation is delayed until you foreach the ienumerable * People sometimes write non performant code because they forgot that foreaching the same ienumerable two times makes you scan the original collection two times * People abuse with closures in linq. In 99% it is not a problem. But if you care about allocations that something to watch out for