. NET Collection Objects FAQ

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.