Why does LINQ .ForEach
require a List
object, while the foreach
statement only requires IEnumerable
?
I prefer using foreach
when having multiple lines and LINQ for single line statements - just for readability.
But what is preferred, and why? And why the difference?