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 8832801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:37:12+00:00 2026-06-14T08:37:12+00:00

Parallel.For allows loops with a max iteration of long.MaxValue Parallel.For(long fromInclusive, long toExclusive, Action<long>

  • 0

Parallel.For allows loops with a max iteration of long.MaxValue

Parallel.For(long fromInclusive, long toExclusive, Action<long> body)
{
}

but what if I need to perform a Parallel loop which would have vastly more iterations than long.MaxValue?

E.G. I have a function which returns the number of required iterations as a BigInteger (because long and ulong are not big enough).

Would I have to “roll my own” Parallel.For implementation. My gut feeling is that this is going to be bad practice!

EDIT: Based on various comments…I think I have bitten off more than I can chew!

  • 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-14T08:37:13+00:00Added an answer on June 14, 2026 at 8:37 am

    I agree with @davenewza, but if you must, this can be a solution

    Parallel.ForEach(BigIntSequence(1,10), (i) => Console.WriteLine(i));
    
    public IEnumerable<BigInteger> BigIntSequence(BigInteger min,BigInteger max)
    {
        BigInteger bi = min;
        while (bi<max)
        {
            yield return bi;
            bi += 1;     
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this works: //delegate Parallel.For(1023456789, 1033456789, delegate(long i) { if (i % 10000000 == 0)
I am trying to allow cancellation of a Parallel.ForEach loop. According to this MSDN
I'm working on an external DSL in F#. The language must allow parallel loops:
I need some class or lib that would allow me to run multiple parallel
I've got a for loop I want to parallelize with something like PLINQ's Parallel.ForEach().
I’m trying to build a parallel implementation of a min-max search . My current
My parallel program is implemented by using c++ and OpenMPI. When I test it,
Are parallel collections intended to do operations with side effects? If so, how can
I am writing simple parallel program in C++ using OpenMP. I am working on
I have a Parallel foreach function that creates a new instance of a class,

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.