CSharp examples for Collection:List
Initialize a List<string> from a Queue<string>
using System;// w ww. ja v a2s. c o m using System.Collections.Generic; class Program { static void Main(string[] args) { Console.WriteLine("\nInitialize a List<string> from a Queue<string>: "); Queue<string> que = new Queue<string>(); que.Enqueue("three"); // Add to a queue by Enqueing items. que.Enqueue("four"); // Enqueued items are added to the "back" of the queue. que.Enqueue("five"); string frontItemFromQueue = que.Dequeue(); List<string> strList2 = new List<string>(que); Console.WriteLine("Resulting list: "); foreach (string s in strList2) { Console.WriteLine(s); } } }