Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8208017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:11:46+00:00 2026-06-07T09:11:46+00:00

I just started using the TPL, and I want to make several calls to

  • 0

I just started using the TPL, and I want to make several calls to web services happen in parallel. From what I can gather, I see two ways of doing this.

Either Parallel.ForEach:

List<ServiceMemberBase> list = new List<ServiceMemberBase>(); //Take list from somewhere.
        Parallel.ForEach(list, member =>
            {
                var result = Proxy.Invoke(member);
                //...
                //Do stuff with the result
                //...
            });

Or Task<T>:

List<ServiceMemberBase> list = new List<ServiceMemberBase>(); //Take list from somewhere.
        ForEach(var member in list)
        {
            Task<MemberResult>.Factory.StartNew(() => proxy.Invoke(member));
        }

        //Wait for all tasks to finish.
        //Process the result objects.

Disregarding if the syntax is correct or not, are these to equivilant?

Will they produce the same result? If not, why? and which is preferable?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:11:48+00:00Added an answer on June 7, 2026 at 9:11 am

    For the code and use case you discuss, the two approaches are essentially equivalent.

    Parallel.ForEach is useful when you have to partition an input range over several tasks (not applicable here), or is easier to synchronize the merging of results of several independent parallel operations (perhaps applicable here?).

    In any case, you’ve correctly noted that in the Parallel.ForEach case, you don’t have to manually synchronize the wait for completion, whereas if you manually start tasks, you do have to manage that synchronization yourself. In this case you would probably use something like Task.WaitAll(...).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started using rapidxml. I 1st create an xml file to read from.
I'm using the TPL ( Task Parallel Library ) in .NET 4.0. I want
I just started using a javascript engine from Microsoft(of IE9?) for developing both desktop
I just started using the new project type SQL Server 2008 Database. I can
Just started using Java (for Android, if that matters) and all I want is
Just started using App Engine's webapp framework, but I can't figure out what's wrong
I just started using Ext JS to build a relatively complex web application for
I just started using jQuery. Now I want to use an jQuery method with
I just started using Twitter Bootstrap http://twitter.github.com/bootstrap/scaffolding.html and I'm looking for the grey/blue navbar
I just started using Eclipse but already I have a small problem. At first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.