I am trying to use System.Threading.Tasks.Parallel.ForEach in a portable class library project using profile 158 (targeting .NET for Windows Store Apps, .NET Framework 4.5, Silverlight 5, and Windows Phone 8.) I'm running Visual Studio Professional 2012 Update 3.
When I write code like this:
var list = new List<int> {1, 2, 3, 4};
int whoCares;
System.Threading.Tasks.Parallel.ForEach(list, (item) => whoCares += item);
the compiler says that "The type or namespace name 'Parallel' does not exist in the namespace 'System.Threading.Tasks'" (I realize this example code is not actually thread-safe.)
I've confirmed on MSDN that Parallel.ForEach is supported for portable class libraries. If I use the Object Browser to browse my reference to ".NET Portable Subset", I see System.Threading.Tasks.Parallel, member of component ".NET Portable Subset", and it does indeed have definitions for System.Threading.Tasks.Parallel.ForEach.
What do I have to do to get access to Parallel.ForEach in my PCL project?