Is the List<T>.ForEach() method gone?

Solution 1:

It's indeed gone:

List<T>.ForEach has been removed in Metro style apps. While the method seems simple it has a number of potential problems when the list gets mutated by the method passed to ForEach. Instead it is recommended that you simply use a foreach loop.


Wes Haggard | .NET Framework Team (BCL) | http://blogs.msdn.com/b/bclteam/

Very strangely, however, it makes an appearance in the documentation, in which nowhere does it state that this method isn't supported in .NET for Windows Store apps (formerly .NET for Metro-style apps). Perhaps this is just an oversight on part of the documentation team.

Solution 2:

To get a sense for why it might no longer be included, read this post by someone who works on the C# team at Microsoft: http://blogs.msdn.com/b/ericlippert/archive/2009/05/18/foreach-vs-foreach.aspx

Basically, it's philosophy. The "LINQ" features are highly inspired by the functional programming paradigm, and the ForEach extension flies in the face of that... it encourages poor functional style.

Also see this answer for more details:

https://stackoverflow.com/a/529197/3043