ArrayList Learn programming C# Sharp

Lesson:

Dynamic Memory Management


Exercise:

ArrayList 44


Objetive:

Create a list of strings, using the class ArrayList which already exists in the DotNet Platform.

Once created, show all the items stored in the list.
Insert one new item in the second place of the list and then show again all the items checking if the insertion was correct.


Code:

using System;
using System.Collections;
namespace List
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList miLista = new ArrayList();
            miLista.Add("Hola,");
            miLista.Add("soy");
            miLista.Add("yo");
            foreach (string frase in miLista)
                Console.WriteLine(frase);
            miLista.Insert(1, "Como estas?");
        }
    }
}