Second one creates a
List
from the
IEnumerable
returned by the query.
This is handy if you want to force the enumeration of the items to happen immediately, as
Linq employs
deferred execution[
^] which means the query isn't fully executed until the items are enumerated.
In some cases it's important that the sequence is only enumerated once, and in those cases it's very convenient to immediately create a list or array from the query and return that.
Hope this helps,
Fredrik