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)