Collections
Collections
Collections means the process of which the objects are handled by your program.it holds a set of classes to have elements in a generalized form.By using collections,you can perform Various operations on objects like the store,search,sort,retrieve, update,delete etc.
Types of collections
There are following types of classes in collection, here are shown below.
System.Collections.Generic Classes
In this classes we use System.Collections.Generic namespace.These Collections are used for type-compatible with the type of collections for items that are stored in generic collection.This collection have set of interfaces and classes. here we show classes that are used in System.Collections.Generic namespace.
List |
List |
LinkedList |
It is used to fast removing and inserting of elements.it uses enumerators. |
Dictionary |
It is used to store key/value pairs.it used the same functionality that is used in non-generic hashtable class. |
Queue |
It use first-in,first-out list.it's functionality similar to that occur in non-generic queue class. |
HashSet |
It is used to prevent duplication in the collection.it is an collection of the unique elements in unordered form. |
SortedList |
it uses the functionality similar to that occur in non-generic sortedlist class.it is key/value pair of sorted list. |
Stack |
it uses First-in,last-out list. |
System.Collections Classes
In this Non-Generic collection we use System.Collections namespace. it is not used for type-compatible with the type of collections for items.It can handle any type of objects.This collection have set of interfaces and classes. here we show classes that are used in System.Collections namespace.
ArrayList | ArrayList means size of array is dynamic not fixed.it's size increase and decrease at runtime. |
Queue | Queue shows first-in,first-out collection of objects.you can use in first-in,first-out access of items. |
Hashtable | Hashtable shows collection of key/value pairs.it is based on hash code of the key. |
Stack | stack is used last-in,first-out pattern(LIFO pattern) for input/output. |
System.Collections.Concurrent Classes
In this collections multiple threads are accessing the collection simultaneously.it gives several threads-safe collection classes that are used in System.Collections.Concurrent namespace. This collection came in dot net framework version 4 and onwards.