.Net Collections

The  System.Collections namespace contains interfaces and classes that define various collections of objects, such as lists, queues, bit arrays, hash tables and dictionaries.

Array list:

Implements the IList interface using an array whose size is dynamically increased as required.

Dictionary Base:

Provides the abstract (MustInherit in Visual Basic) base class for a strongly typed collection of key-and-value pairs. Dictionary is a Generic type. So we can get type safety with Dictionary.

Hash table:

Represents a collection of key-and-value pairs that are organized based on the hash code of the key.
A key cannot be a null reference (Nothing in Visual Basic), but a value can be. Hashtable is not a Generic type. So we can’t get type safety with Hashtable. Hashtable is thread safe.

Queue:

Represents a first-in, first-out collection of objects.
Queues are useful for storing messages in the order they were received for sequential processing.

Stack:

Represents a simple last-in-first-out collection of objects.
Stack is implemented as a circular buffer.
A SortedList is a hybrid between a Hashtable and an Array. When an element is accessed by its key using the Item indexer property, it behaves like a Hashtable. When an element is accessed by its index using GetByIndex or SetByIndex, it behaves like an Array.

Sorted List:

Represents a collection of key-and-value pairs that are sorted by the keys and are accessible by key and by index.

Dictionary Entry:

Defines a dictionary key-and-value pair that can be set or retrieved.

Linked List:

It is a data structure that consists of a sequence of data records such that in each record there is a field that contains a reference (i.e., a link) to the next record in the sequence.
  •           Linear Linkedlist, Circular Linkedlist, Single Linkedlist, Doubly Linkedlist, Multiple Linkedlist.
  •         The advantage of a linked list over arrays or even the generic List is that items can be added or removed at any point in constant time.
  •           The primary disadvantage of using a linkedlist is that the data structure does not allow random access.

Comments

Popular posts from this blog

BDD - Acceptance Test Driven Development

Angular JS – Part 2