Differences between. NET 2.0 generic collection classes and. NET 1.1 Collection classes (III)

Source: Internet
Author: User
4. collection <t> and keyedcollection <tkey, titem>
I think the biggest beneficiary of the paradigm is the collectionbase class. In the past, to create a collection class, we had to inherit from collectionbase and complete the work of strong-type methods and internal interception operations, with the model, you do not have to do the work of using a strongly typed Method on your own.

The original collectionbase is an abstract class, and collection <t> is now a non-abstract class, you can use it directly, but honestly, if you areProgramWe recommend that you use the list instead of the collection.

Microsoft. On the collection <t>, another keyedcollection <tkey, titem> is inherited. This class is not originally available. He is very interesting. He has both the functions of searching collections by number and the features of searching dictionaries by key. Therefore, he is an ideal basic class when you publish a set of dictionary types.
It requires that you must reload the. getkeyforitem (titem) method to obtain the key of the specified project. Unfortunately, Ms seems to have forgotten to wrap the dictionary's trygetvalue.

Readonlycollection <t> is very suitable for the basic classes of collection classes in the read-only version.

5. bindinglist <t>
Normally, if a collection class (such as collection <t>) is bound to a table or other control, you will find that some functions are unavailable, for example, you have called the delete record method of the set, but the table is not automatically refreshed in a timely manner. To more easily support binding to object sets, Ms designs the bindinglist <t> class, which is located in system. the componentmodel namespace that supports the complete set binding operation (ibinglist Interface), such as the data sensing function.
.

Differences between. NET 2.0 generic collection classes and. NET 1.1 Collection classes (1)
Differences between. NET 2.0 generic collection classes and. NET 1.1 Collection classes (2)

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.