DoNotExposeGenericLists fires when I publicly expose List via a field, method, property, or parameter. Why? Although Krzysztof briefly touched on this last year, we wanted to expand on this a little through the use of examples....
See more »
DoNotExposeGenericLists fires when I publicly expose List via a field, method, property, or parameter. Why? Although Krzysztof briefly touched on this last year, we wanted to expand on this a little through the use of examples. The first reason is that List is designed for speed and for use as an internal implementation detail, whereas Collection is designed for extensibility. Collection provides 4 overridable methods; ClearItems, InsertItem, RemoveItem and SetItem, which allow a derived class to be notified when a collection has been modified. In contrast, List provides none. As an example, let’s say in V1.0 of your framework, you have a Person class that exposes a collection of addresses. You could choose to expose this via a property that returns either a List or Collection :
See less »
Kaboodle will send you a newsletter and updates from your friends. You can unsubscribe at any time. Kaboodle does not sell or share your email address or personal information with anyone.
Kaboodle requires all users to provide their real date of birth as both a safety precaution and as a means
of preserving the integrity of the site. You will be able to hide this information from your profile if you wish.
Added by 1 people