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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:01:28+00:00 2026-06-17T19:01:28+00:00

KeyValuePair<int, string>[][] partitioned = SplitVals(tsRequests.ToArray()); Don’t worry too much about the method i use;

  • 0
KeyValuePair<int, string>[][] partitioned = SplitVals(tsRequests.ToArray());

Don’t worry too much about the method i use; lets just say i get a jagged array of KeyValuePairs that are split equally into different arrays.

foreach (KeyValuePair<int, string>[] pair in partitioned)
{
    foreach (KeyValuePair<int, string> k in pair)
    {
    }
}

I need to know how i can efficiently get the ints in an int array, and the strings in a seperate string array from the array of keyvaluepairs. That way both of the indexes match eachother in seperate arrays.

For example, after i split it into an int[] array and a string[] array,

intarray[3] must match stringarray[3] just like it did in the keyvaluepair.

Lets say i have a jagged array with KVP like:

    [1][]<1,"dog">, <2,"cat">
    [2][]<3,"mouse">,<4,"horse">,<5,"goat">
    [3][]<6,"cow">

I need this to turn into during each iteration

    1. 1,2 / "dog","cat"
    2. 3,4,5 / "mouse", "horse", "goat"
    3. 6 / "cow"
  • 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-17T19:01:29+00:00Added an answer on June 17, 2026 at 7:01 pm
    int[] keys = partitioned.Select(pairs => pairs.Select(pair => pair.Key).ToArray())
        .ToArray();
    string[] values = partitioned.Select(pairs => pairs.Select(pair => pair.Value).ToArray())
        .ToArray();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method that returns an IEnumerable<KeyValuePair<string, ArrayList>> , but some of the
I'm trying to pull out the Roles below into an IEnumerable<KeyValuePair<int, string>> <PROJECT PROJECT_NO=161917>
i try: List<KeyValuePair<string, object>> ParamCollOutput= new List<KeyValuePair<string, object>>(); ParamCollOutput.Add(new KeyValuePair<string, object>(@MenuID, SqlDbType.Int)); ParamCollOutput.Direction =
I have a KeyValuePair List in C# formatted as string,int with an example content:
My initialization is: List<string> convertedList = new List<string>(); List<KeyValuePair<string, int>> originalList = new List<KeyValuePair<string,
This is my list List<KeyValuePair<string, int>> lstRodsMonsterPool = new List<KeyValuePair<string, int>>(); Now i am
I have a Dictionary<int,List<string>> . I have multiple KeyValuePairs so int the first KeyValuePair
I have this little piece of code : private Dictionary<string, IList<KeyValuePair<int, string>>> EnumsCollection =
I have two DropDownList elements in my model. [DisplayName(Site)] public List<KeyValuePair<int, string>> Site {
In C# I would like to sort a List<KeyValuePair<int, string>> by the length of

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.