How to copy a range of items from 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 alist = new ArrayList();

            alist.Add("java");
            alist.Add("c#");
            alist.Add("c++");
            alist.Add("c");
            alist.Add("python");

            ArrayList alist_range = alist.GetRange(2, 2);

            foreach (string s in alist_range)
                Console.WriteLine(s); 
        }
    }
}

/*
run:
 
c++
c
 
*/

 



answered Jan 7, 2017 by avibootz

Related questions

1 answer 186 views
1 answer 176 views
1 answer 174 views
1 answer 153 views
1 answer 138 views
1 answer 191 views
...