11.03 - Queue- Collections

Objetive

Create a queue of strings, using the class Queue which already exists in the DotNet Platform.
Once created, show all the items stored in the queue.


Solution

using System;
using System.Collections;

class Program
{
    static void Main ( )
    {
        bool depurando = true;

        Queue miCola = new Queue();
        miCola.Enqueue("Hola,");
        miCola.Enqueue("soy");
        miCola.Enqueue("yo");

        int cantidadCola = miCola.Count;

        for (byte i = 0; i < cantidadCola; i++)
            Console.WriteLine(miCola.Dequeue());

        if (depurando)
            Console.ReadLine();
    }
}

Popular Posts