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.
ArrayList:
Now, we discussed about How to use Arraylist.Add Method in C#.net?
Hello World
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.
ArrayList:
Now, we discussed about How to use Arraylist.Add Method in C#.net?
Using System.Collections
ArrayList ArrayLst = new ArrayList ()
ArrayLst.Add("Hello");
ArrayLst.Add ("World");
foreach (Object Obj in ArrayLst)
Console.WriteLine (Obj.Tostring ())
Output:ArrayList ArrayLst = new ArrayList ()
ArrayLst.Add("Hello");
ArrayLst.Add ("World");
foreach (Object Obj in ArrayLst)
Console.WriteLine (Obj.Tostring ())
Hello World