Collections help to group related items together thereby increasing the code readability & maintainability.
In C#, System.Collections namespace contains the rich list of collection objects that can be used depending on the number of items, their datatypes and other factors.
Arraylist: Simple, unordered, indexed-based collection. It can contain object of any type.
SortedList: Sorted collection of name/value pair. Supports sorting.
Queue: FIFO collection. Has methods that support Queue/Enqueue from Queue List.
Stack: Contrast to Queue, stack is a LIFO collection. Has methods that support Push/Pop from stack.
Hashtable: A collection of name/value pairs of object allowing retrieval by name or index.
BitArray: Resizable collection storing boolean values. It Supports bit-wise operations like AND, OR, X-OR.
BitVector32: Supports bit-wise operations on boolean values. stores data as a single 32-bit integer.
StringCollection: Similar to ArrayList collection, but stores only string objects.
StringDictionary: Similar to Hashtable collection, but strongly typed class to have both key/value pair
to be only strings.
ListDictionary: Collection used to store small lists of objects.
HybridDictionary: Uses ListDictionary when number of items in collection is small. Switches to
Hashtable for handling large number of items.
NameValueCollection: Pretty much like StringDictionary, but allows you to store multiple values per key.
Subscribe to:
Post Comments (Atom)
0 comments
Post a Comment