Queue Collections Learn programming C#

Lesson:

Dynamic Memory Management


Exercise:

Queue Collections


Objetive:

Create a string queue using the Queue class that already exists in the DotNet platform.


Code:

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();
    }
}

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.