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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:32:32+00:00 2026-05-27T19:32:32+00:00

Okay, so this seems simple, but I can’t think of a straightforward solution; Basically

  • 0

Okay, so this seems simple, but I can’t think of a straightforward solution;
Basically I have an object array in C# that contains, say, 102 elements. I then also have 4 other empty arrays. I want to iterate through the original array and distribute the 100 elements evenly, then distribute 101 and 102 to the 1st and 2nd new arrays respectively.

int i = 1,a=0, b=0, c=0, d = 0;

foreach (ReviewStatus data in routingData)
{
    if (i == 1)
    {
        threadOneWork[a] = data;
        a++;
    }
    if (i == 2)
    {
        threadTwoWork[b] = data;
        b++;
    }
    if (i == 3)
    {
        threadThreeWork[c] = data;
        c++;
    }
    if (i == 4)
    {
        threadFourWork[d] = data;
        d++;
        i = 0;
    }
    i++;

}

Now the above code definitely works, but I was curious, does anybody know of a better way to do this??

  • 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-05-27T19:32:32+00:00Added an answer on May 27, 2026 at 7:32 pm
    var workArrays = new[] { 
        threadOneWork,
        threadTwoWork,
        threadThreeWork,
        threadFourWork, 
    };
    
    for(int i=0; i<routingData.Length; i++) {
        workArrays[i%4][i/4] = routingData[i];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay this may be a simple question but I have yet to come with
Okay, this seems like it should be relatively simple, but I've been Googling for
Okay, I know this is probably dead simple, but I can't seem to find
Okay, so first, I have searched for this everywhere but it seems like every
okay, this has got to be simple - but I can't seem to find
Okay, it seems to be a stupid question, since we have this However, up
Okay, Now admittedly this sounds like a silly question; But, I actually have a
I am hoping that someone can help me with this relative simple problem: <?php
This should be a very simple thing to have run, but for some reason
So this seems like a simple little problem, but I haven't been successful with

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.