© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
6 replies
Pedro Furlan

✅ Foreach vs Parallel.ForEach with Async mehtods

I recently changed my code who had foreach to Parallel.Foreach. This foreach has multiples asynchronous methods and when i run with simple foreach ,the methods are called normally but, when i changed foreach to Parallel.Foreach looks like the code not work well , he literally goes crazy, one time runs ok and other time throws exception , why this occurs ? Am i done something wrong ? My project are in .NET CORE 3.1. Follow my code with foreach and Parallel.Foreach.
image.png
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Parallel.ForEach is actually slow
C#CC# / help
3y ago
Foreach vs Count with likes table
C#CC# / help
4y ago
❔ Foreach
C#CC# / help
3y ago