Funny you mention that, in C# they do have a parallel keyword.
Parallel.ForEach(files,(currentFile)=>{// The more computational work you do here, the greater// the speedup compared to a sequential foreach loop.stringfilename=Path.GetFileName(currentFile);varbitmap=newBitmap(currentFile);bitmap.RotateFlip(RotateFlipType.Rotate180FlipNone);bitmap.Save(Path.Combine(newDir,filename));// Peek behind the scenes to see how work is parallelized.// But be aware: Thread contention for the Console slows down parallel loops!!!Console.WriteLine($"Processing {filename} on thread {Thread.CurrentThread.ManagedThreadId}");//close lambda expression and method invocation});
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Funny you mention that, in C# they do have a parallel keyword.