How to Insert an item in ArrayList with 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");

            alist.Insert(4, "vb.net");

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

/*
run:

java
c#
c++
c
vb.net
python

*/

 



answered Jan 7, 2017 by avibootz

Related questions

1 answer 221 views
1 answer 192 views
192 views asked Jan 7, 2017 by avibootz
1 answer 200 views
1 answer 167 views
3 answers 196 views
...