2 ms·
This is generally better yes, especially if it's going to end up inside another LINQ operation - you can avoid materializing the list. Cases where it isn't: -
by pjc50 1y ago
This is generally better yes, especially if it's going to end up inside another LINQ operation - you can avoid materializing the list.
Cases where it isn't:
- risk of multiple execution (there is a CA warning for this)
- when returning data protected by a mutex, you should always materialize a copy of the returned list/array rather than return an enumerable