Tuesday 29 May 2018

Stack Class generic Collection in C#





using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;



namespace ConsoleApplication32

{

    class Program

    {

        static void Main(string[] args)

        {





            Stack<string> s = new Stack<string>();

            s.Push("ALI");

            s.Push("Ahmed");

            s.Push("Basit");

            s.Push("zahid");

            s.Push("danish");

            s.Push("hasan");





            foreach (var item in s)

            {

                Console.WriteLine(item);

            }

            Console.WriteLine("Top Element is "+s.Peek());

            Console.WriteLine("press any key to pop element : ");

            Console.ReadKey();

            s.Pop();

            Console.WriteLine("Top Element is " + s.Peek());

            foreach (var item in s)

            {

                Console.WriteLine(item);

            }



            Console.ReadLine();

         



        }

    }

}


Sorted Set Class in C#





using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;



namespace ConsoleApplication32

{

    class Program

    {

        static void Main(string[] args)

        {



            var x = new SortedSet<string>();

            x.Add("Zahid");

            x.Add("Ali");

            x.Add("Bilal");

            x.Add("Danish");

            x.Add("ali");



            foreach (var item in x)

            {

                Console.WriteLine(item);

            }



            Console.ReadLine();

         



        }

    }

}


Hash set Generic Class in C#





using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;



namespace ConsoleApplication32

{

    class Program

    {

        static void Main(string[] args)

        {



            var x = new HashSet<string>();



            x.Add("ali");

            x.Add("AHMED");

            x.Add("ali"); //DUPLICATE......

            x.Add("ARIF");

            x.Add("ASIM");





            foreach (var item in x)

            {

                Console.WriteLine(item);

            }



            Console.ReadLine();





        }

    }

}


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 ...