11.05 - ArrayList


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.


using System;
using System.Collections;

namespace List
    class Program
        static void Main(string[] args)
            bool depurando = true;

            ArrayList miLista = new ArrayList();
            // AƱadimos elementos
            // Mostramos lo que contiene 
            foreach (string frase in miLista)
                Console.WriteLine( frase );

            // Insertamos en la segunda posicion 
            miLista.Insert(1, "Como estas?");
            // Mostramos de otra forma lo que contiene 
            for (int i=0; i

Popular Posts