.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson

Home >> Articles >> C# >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Collections in C#.net

Posted By:Narayanan       Posted Date: September 26, 2011    Points: 200    Category: C#    URL: http://www.dotnetspark.com  

Here, we discussed about Collection in .Net framework. I explain How to use System. Collections in C#.net? and what are the Collections? and How to use Array List in C#.net?


  What is mean by Collections?

          Collections contain number of  classes  to required for storing group of related objects.


What are the Collections Classes?

1)    Array List

2)    Queue

3)    Stack

4)     StringCollection

5)    BitArray


1)    Array List:

            Can Store any type of object.

            Expand to any required capacity


2)    Queue:

First in First Out (FIFO) Collection.

      On messaging server to store messages temp before Processing


3)    Stack:

     Last in First Out (LIFO) Collection.

     Stack to track change so that the most recent change can be undone.



4)    StringCollection:

                     Like ArrayList, except values are strongly typed as a strings.

                      Does not support Sorting.


5)    BitArray:

                       A collection of Boolean values.



   Now, we discussed about How to use Arraylist.Add Method in C#.net?


Using System.Collections

// Coding

ArrayList ArrayLst = new ArrayList ()


ArrayLst.Add ("World");

foreach (Object Obj in ArrayLst)

         Console.WriteLine (Obj.Tostring ())


  Hello World

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend