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

  • SEARCH
  • Home
  • 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 8911551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:58:30+00:00 2026-06-15T03:58:30+00:00

If I have the following order in an IEnumerable (list) : 1 – 2

  • 0

If I have the following order in an IEnumerable (list) :

1 – 2 – 3 – 4 – 5

and If I run a PLINQ query on this say :

list.AsParallel().AsOrdered().WithDegreeOfParallelism(10).Select(
                s => SomeDelegateFunction(s)).AsSequential().ToList();

For the above query I see in my logging (inside delegate function) that it uses multiple threads, but does not maintain the sequence of processing of the list.
However for the below query i does maintain the sequence but uses a single thread to do the entire operation:

list.AsParallel().AsOrdered().WithDegreeOfParallelism(10).AsSequential().Select(
               s => SomeDelegateFunction(s)).ToList();

The difference between the two queries is the “AsSequential()” in the second query, the question I had is that when I use AsSequential() :

1 – Why does it not use multi threads? It could have broken down the work as :

1 - 2 (Give it to thread 1)
3 - 4 - 5 (Give it to thread 2)

Instead it does do 1 – 2 – 3 – 4 – 5 (In that order) but does it on a single thread – why??

Basically I need to process my list in the ORDER it came into as input but on multiple threads.

Any ideas ?

  • 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-15T03:58:31+00:00Added an answer on June 15, 2026 at 3:58 am

    Basically I need to process my list in the ORDER it came into as input but on multiple threads.

    Those are mutually exclusive requirements. You can do one or the other, but never both.

    If you don’t care what order the items were processed in, you just want to make sure that your end result is that the objects are in the order that they first came in as you can do something like this:

    var list = new List<int> { 1, 2, 3, 4, 5 };
    
    Parallel.For(0, list.Count, i =>
    {
        list[i] = Process(i);
    });
    

    If you prefer PLINQ over Parallel.For you could do something like this:

    Enumerable.Range(0, list.Count)
        .AsParallel()
        .WithDegreeOfParallelism(10)
        .ForAll(i =>
        {
            list[i] = Process(i);
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following lambda expression: IEnumerable<Order> query = _ordersRepository.GetAllByFilter( o => o.OrderStatus.OrderByDescending(os =>
I have the following table: Order Product Price Quantity Description Order1 Product1 12 1
I have the following higher-order function: public static Func<T, bool> Not<T>(Func<T, bool> otherFunc) {
I have the following Mysql Table Order table status 0 - incomplete status 1
I have HTML which includes scripts in following order <script src=../static/js/jquery.js type=text/javascript> <script src=../static/js/bootstrap.js
I have the following index I'm creating in order to get all the permissions
I have written the following algorithm in order to evaluate a function in MatLab
I have the following html code (in the given order) <div id=content>...</div> <div id=footer>...</div>
I have the following rewrite rule that I need to alter in order to
Lets assume I have the following 3 entities: Customer,Order,Product which interact in the View

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.