Question - C# program to remove an element from the queue.
Answer -
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Application
{
class DemoProgram
{
static void Main(string[] args)
{
Queue qs = new Queue();
qs.Enqueue(1);
qs.Enqueue(2);
qs.Enqueue(3);
foreach (Object ob in qs)
{
Console.WriteLine(ob);
}
Console.WriteLine(); Console.WriteLine();
Console.WriteLine("Total number of elements in the Queue " + qs.Count);
Console.WriteLine("Does the Queue contain " + qs.Contains(3));
Console.ReadKey();
}
}
}