Compilenix's Blog - Why IEnumerable slow and List is fast?

RSS Feed | Find Stuff

Why IEnumerable slow and List is fast?

This is because of deferred execution: the enumeration is produced by evaluating the sequence of filters for each item. When you do a ToList, however, the sequence is "materialized" in memory, so all the evaluations are performed exactly once.

Source: https://stackoverflow.com/a/19689385