Let's say I have
foreach(int x in xs[]) // xs is an array of int
{
x++;
}
Each time through the foreach is independent of the others. Is there a quick way to instruct the CLR to do each on a seperate thread or speed it up by natively parallelising it?
Maybe it already knows to do this.
I know you I could create threads and start them but it would be swell if there was an attribute or flag I could set that would take care of it for me.
My actual code is more complex but each iteration through the foreach is also free of effect between iterations.
something like
[parallelize maxThreads=5]
foreach(int x in xs[]) // xs is an array of int
{
x++;
}