INTERFACES
IComparable : Used to compare two objects and determine which object is greater.
The CompareTo method returns 1, 0, or -1 if the value of the current object is greater than, equal to, or less than the object passed as a parameter to this method.
ICollection: defines the size, enumerators, and synchronization methods for all non-generic and generic collections.
Non-Generic : AddAt, AddItem, GetEnumerator, Item methods,IsReadOnly and Count properties
Generic : Add, Clear, Contains, CopyTo, Remove,Count methods.
IList :Used to index a collection..
Generic & Non-Generic : Insert, IndexOf, and RemoveAt methods.
Non-Generic: Add, Clear, Contains, IndexOf, Insert, Remove, and RemoveAt methods.
IComparer: The non-generic IComparer interface provides the Compare method same as Compare method of IComparable.
In the generic version ,both parameters are passed as a specific data type.
IEqualityComparer:Used to check if two collections are equivalent.
Non-Generic: Equals(determines if two system.Object are equivalent or not) and GetHashCode(returns same hashcode if two collections are equivalent.
The generic version accepts parameters of a specific data type.
IDictionary:The non-generic IDictionary provides the collection key/value pair behavior.
The generic version allows the key and the value to be declared as specific data type.
IEnumerable: It provides the GetEnumerator method to enumerate the collection and returns the IEnumerator data type.
IEnumerator: Non genric version supports a simple iteration in a non-generic collection. This interface is the base interface of all non-generic enumerators. e.g.For each in vb.net and foreach in C#
Non-Generic: MoveNext , Reset methods ,current property(returns a data type of system.object)
The generic version provides the strongly typed Current property.
ArrayList : Can be resized.
Implements IList
Stack : based on LIFO
Queue :Based on FIFO
Iterator : used in C#
Comparer :
Default method that provides a comparison based on the current culture
DefaultInvariant that provides a culture-independent comparison
HashTable : represents a collection of name/value pairs
The key is stored as an object and its hash code is used to identify the value which makes data retrieval very fast.
Allows you to dynamically add and remove elements without re-indexing.
Doesnt have a generic version
Implements IEnumerator
Disadvantage : doesnt allow sorting
SortedList:represents a collection of name/value pairs that are accessible either by key or by index, but are sorted only by keys.
The SortedList class maintains two arrays to store the elements of the list, one array for the keys and another for the associated values.
The elements are sorted by keys.
Does not allow duplication of keys.
Indexing adjusts when you add or remove a element .
Slower than hashtable becoz of sorting process. However,compared to hashtable more flexible as flexibility it can be accessed by key or index.
BitArray: implements a bit structure, which represents a collection of binary bits, 1s and 0s.
The size of a bit structure in memory depends on the number of elements in the collection.
Elements are accessed using an integer index.
Zero-based indexes.
To add element use Length property
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment