Thursday, 31 May 2018

Queue Class in C# Generic Collection class





using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;



namespace ConsoleApplication33

{

    class Program

    {

        static void Main(string[] args)

        {



            Queue<string> li = new Queue<string>();



            li.Enqueue("ali");

            li.Enqueue("ahmed");

            li.Enqueue("ahsan");

            li.Enqueue("asim");





            Console.WriteLine("top element : "+li.Peek());



            foreach (var item in li)

            {

                Console.WriteLine(item); 

            }



            Console.WriteLine("Press any key to dequeue...");

            Console.ReadLine();

           li.Dequeue();


            Console.WriteLine("top element : " + li.Peek());

            foreach (var item in li)

            {

                Console.WriteLine(item);

            }

            Console.ReadLine();

        }

    }

}


No comments:

Post a Comment

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...