How to add ArrayList to other ArrayList in C#

1 Answer

0 votes
using System;
using System.Collections;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList alist1 = new ArrayList();

            alist1.Add(190);
            alist1.Add(42);
            alist1.Add(13);
            alist1.Add(18181);
            alist1.Add(9);

            ArrayList alist2 = new ArrayList();
            alist2.Add(100);
            alist2.Add(200);
            alist2.Add(300);

            alist1.AddRange(alist2);

            foreach (int n in alist1)
                Console.WriteLine(n);
        }
    }
}

/*
run:

190
42
13
18181
9
100
200
300

*/

 



answered Jan 6, 2017 by avibootz
...