Queue<(Of <(T>)>) generic class, including the ToArray method. : Queue « Data Structure « C# / CSharp Tutorial






using System;
using System.Collections.Generic;

class Example
{
    public static void Main()
    {
        Queue<string> numbers = new Queue<string>();
        numbers.Enqueue("one");
        numbers.Enqueue("two");
        numbers.Enqueue("three");
        numbers.Enqueue("four");
        numbers.Enqueue("five");

        Queue<string> queueCopy = new Queue<string>(numbers.ToArray());

        Console.WriteLine("\nContents of the first copy:");
        foreach( string number in queueCopy )
        {
            Console.WriteLine(number);
        }

    }
}








11.38.Queue
11.38.1.Enqueue and dequeue
11.38.2.Clear a Queue
11.38.3.Peek a queue
11.38.4.Creating a list from a queue
11.38.5.Dequeue and Peek
11.38.6.Queue<(Of <(T>)>) generic class, including the ToArray method.
11.38.7.Queue<(Of <(T>)>) generic class, the Dequeue method.