parallel.foreach vs foreach in c#
what is difference between parallel.foreach vs foreach in c# with example
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Raja TPosted Sep 2, 2015, 8:53 AM
Foreach loop:
Iterations takes place sequentially one by one
foreach loop is run from a single Thread.
foreach loop is defined in every framework of .NET
Execution is slower
Parallel.ForEach:
Execution takes place in parallel way.
Parallel.ForEach uses multiple Threads.
Parallel.ForEach is defined in .Net 4.0 and above frameworks.
Execution is faster3
more details check out bellow urls
Devinder KumarPosted Sep 30, 2015, 12:17 AM