Advanced  Services Generische Containerklassen


Generische Containerklassen



Alle Klassen leiten sich direkt von Object ab.


Die Methoden und Properties der Interfaces IEnumerable<T>, ICollection<T> und IList<T>

csharp-ilist-t-methoden.jpg missing


List

List ist vermutlich die am meisten verwendete Behälterklasse.








Collection










LinkedList





Queue





Stack






HashSet

Aus der API

The objects used as keys by a Hashtable are required to override the Object.GetHashCode method (or the IHashCodeProvider interface) and the Object.Equals method (or the IComparer interface). The implementation of both methods and interfaces must handle case sensitivity the same way; otherwise, the Hashtable might behave incorrectly. For example, when creating a Hashtable, you must use the CaseInsensitiveHashCodeProvider class (or any case-insensitive IHashCodeProvider implementation) with the CaseInsensitiveComparer class (or any case-insensitive IComparer implementation).

Furthermore, these methods must produce the same results when called with the same parameters while the key exists in the Hashtable. An alternative is to use a Hashtable constructor with an IEqualityComparer parameter. If key equality were simply reference equality, the inherited implementation of Object.GetHashCode and Object.Equals would suffice.

Key objects must be immutable as long as they are used as keys in the Hashtable.

When an element is added to the Hashtable, the element is placed into a bucket based on the hash code of the key. Subsequent lookups of the key use the hash code of the key to search in only one particular bucket, thus substantially reducing the number of key comparisons required to find an element.

Quelle: http://msdn.microsoft.com/en-us/library/system.collections.hashtable%28v=vs.80%29.aspx





SortedSet