Posts about LINQ

Beware of LINQ deferred execution

December 16th 2022 LINQ

Normally, you do not have to worry about deferred (or lazy) execution of LINQ operators. Everything works as expected, often even with better performance. However, you should be aware of it, because in some cases the code does not behave as expected because of it.

Deferred Evaluation of Collections Passed as Parameters

May 26th 2014 Validation LINQ

Having a parameter of type List is not recommended; IList or even IEnumerable should be used instead when a parameter is only going to be used for iterating through the list of items. This way different types of collections, such as arrays, lists, etc. can be passed to it. But IEnumerable can prove even more useful in certain scenarios.