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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:34:54+00:00 2026-05-18T21:34:54+00:00

i have numbers that user enter in textBox3 and i converted them to an

  • 0

i have numbers that user enter in textBox3 and i converted them to an array nums now i want to put half of them in arraylist A and half of them in arraylist B how can i do that?thanks

 string[] source = textBox3.Text.Split(',');

 int[] nums = new int[source.Length];

 for (int i = 0; i < source.Length; i++)
 {
     nums[i] = Convert.ToInt32(source[i]);
 }

   ArrayList A = new ArrayList();

   ArrayList B = new ArrayList();

edited:

thanks,i tested your answers but output of all of your codes are system.collection.generic[system.int32],whats the problem?thanks

for example i tested this that ArsenMkrt wrote:

  private void button1_Click(object sender, EventArgs e)
    {
        string[] source = textBox3.Text.Split(',');
        int[] nums = new int[source.Length];

List<int> A = nums.Take(source.Length/2).ToList();

List<int> B = nums.Skip(source.Length/2).ToList();


            MessageBox.Show(B.ToString());
        }
  • 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-18T21:34:54+00:00Added an answer on May 18, 2026 at 9:34 pm

    It’s not recommended using array list because of boxing issues so use lists:

    List<int> lst1 = new List<int>();
    lst1.AddRange(nums.Skip(nums.Length/2));
    
    List<int> lst2 = new List<int>();
    lst2.AddRange(nums.Take(nums.Length / 2));
    

    first list contains length/2 to length and second list contains first item to length / 2

    Edit: See 101 linq sample for interducing to linq.

    Edit: for showing the items in list should traverse list, list.ToString() returns type of list See MSDN ToString not items, so you should override it and use your specific list or do:

    foreach (var i in lsss)
    {
      MessageBox.Show(i.ToString());
    }
    

    Or

    lst1.ForEach(x=>MessageBox.Show(x.ToString()));
    

    Or

    string strList = "";
    lst1.ForEach(x => strList += x + " , ");
    MessageBox.Show(strList);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that allows the user to enter a level number, and
I have a form where a user can enter the number of students that
I have a table that has account numbers in (account_num) and user profiles (profile_id).
Lets say I have an array numbers that contains the following values: int numbers
In my website I have a textbox that allow user to enter a group
I have a textbox that the user can input into. Right now the user
I have a simple application that has richTextBox and button. User enters numbers(integers) into
I have a textbox that the user suppose to place numbers on it, and
I have a following table using MVC that shows number of items the user
I have an application that calls a number stored by the user. Everything works

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.