That’s the tricky part, asSequence() avoids the intermediate list allocations, but at the cost of lambda overhead. For tiny operations, either will probably be fine, but for larger collections you’d have to run performance tests to find out which drawback hurts the least, which is why I advocate for enhancing the language’s inlining features so that developers don’t have to make the choice between optimal readability and optimal performance.
1 Like