why ForEach Linq Extension on List rather than on IEnumerable [duplicate]
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Why is there not a ForEach extension method on the IEnumerable interface? Hello, My question is why Foreach extension method is defined on List rather than IEnumreable. i have read Eric Lippert's article but the point is, if it is so bad to have such method than why is it there for List? 回答1: List<T>.ForEach() isn't an extension method. It's just a method on List<T> . One of the main reasons that it isn't