Q:

Give an example of removing an element from the queue?

0

Give an example of removing an element from the queue?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

The dequeue method is used to remove an element from the queue.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestApplication
{
class Program
{
    static void Main(string[] args)
    {
        Queue qt = new Queue();
        qt.Enqueue(1);
        qt.Enqueue(2);
        qt.Enqueue(3);
        foreach (Object obj in qt)
        {
            Console.WriteLine(obj);
        }
        Console.WriteLine();
        Console.WriteLine();
        Console.WriteLine("The number of elements in the Queue " + qt.Count);
        Console.WriteLine("Does the Queue contain " + qt.Contains(3));
        Console.ReadKey();
    }
}
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C# Interview Questions and Answers,You Need To Know

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
What is the difference between directcast and ctyp... >>
<< What is Reflection in C#?...