How to create ArrayList from array in C#

1 Answer

0 votes
using System;
using System.Collections;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] array = { 1, 2, 3, 4, 5 };

            ArrayList alist = new ArrayList(array);

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


/*
run:
 
1
2
3
4
5
 
*/

 



answered Apr 30, 2017 by avibootz

Related questions

1 answer 110 views
2 answers 225 views
1 answer 104 views
1 answer 185 views
1 answer 183 views
1 answer 148 views
148 views asked Apr 21, 2020 by avibootz
1 answer 159 views
...