If you have a headache with a large collection of objects in. Net, now let me take you out as your "guide". Help you find your own direction in the System.Collections name field. The collection provides a way to format arbitrary objects, and we all know how helpful they are in everyday program design. Then I'll find it and know it.
First, the definition
from the point of view of. NET, a collection can be defined as one that implements one or more System.Collections.ICollection, The System.Collections.IDictionary and System.Collections.IList interface objects. It is used to format the storage of arbitrary objects, which makes our data more flexible.
Second, classification
According to the above definition, the "built-in" collection can be divided into three categories within the scope of the System.Collections name Domain space:
(i) an ordered set : implements only the set of ICollection interfaces, in fact the order of insertions determines the order in which objects are retrieved from the collection, The System.Collections.Stack class and System.Collections.Queue are examples of two ICollection collections.
(ii) indexed collections : implements a collection of IList interfaces whose content can be retrieved from a zero-based numeric index, just like an array. The System.Collections.ArrayList object is an example of an indexed collection.
(c) Key value collection : implements a collection of IDictionary interfaces that contain items that can be retrieved by certain associated key values. The content of IDictionary is usually sorted in some form based on the key value, which can be represented as a well-ordered enumeration when retrieved.
The System.Collections.HashTable class implements the IDictionary interface.
As you can see, the function of a given set is controlled by a specialized interface or the interface it implements, and if you are not in a lot of contact with the object program, it seems to be very confusing, if not meaningless. However, you should be aware that the ability to build an object in this way not only gives a similar set of method signatures to similar objects, but also allows them to be treated as essentially identical classes when necessary, which is what is called polymorphism in object-oriented programming.
Iii. Summary
These are just a few simple sets of knowledge, will be added in the future.
. NET Collection Objects FAQ