static void Main(string[] args) { var queue = new LinkedQueue <int>(); queue.Enqueue(5); var arr = queue.ToArray(); foreach (var item in arr) { Console.WriteLine(item); } }
public static void Main() { var linkeQueue = new LinkedQueue <int>(); linkeQueue.Enqueue(1); linkeQueue.Enqueue(3); linkeQueue.Enqueue(69); linkeQueue.Enqueue(100); Console.WriteLine(linkeQueue.Count); linkeQueue.Dequeue(); linkeQueue.Dequeue(); linkeQueue.Dequeue(); linkeQueue.Dequeue(); Console.WriteLine(linkeQueue.Count); try { linkeQueue.Dequeue(); } catch (InvalidOperationException ex) { Console.Error.WriteLine(ex.Message); } linkeQueue.Enqueue(1); linkeQueue.Enqueue(3); linkeQueue.Enqueue(69); linkeQueue.Enqueue(100); while (linkeQueue.Count > 0) { Console.WriteLine(linkeQueue.Dequeue()); } linkeQueue.Enqueue(1); linkeQueue.Enqueue(3); linkeQueue.Enqueue(69); linkeQueue.Enqueue(100); var arr = linkeQueue.ToArray(); Console.WriteLine(string.Join(", ", arr)); }
static void Main(string[] args) { LinkedQueue <string> numbers = new LinkedQueue <string>(); for (int i = 0; i < 100; i++) { numbers.Enqueue(i.ToString()); } Console.WriteLine("To array"); Console.WriteLine(string.Join(", ", numbers.ToArray())); Console.WriteLine("Dequeue"); while (numbers.Count > 0) { Console.Write(numbers.Dequeue() + (numbers.Count != 0 ? ", " : String.Empty)); } Console.WriteLine(); }