Feature: change the policy concerning specialized collections in the framework and make them really specialized #55773
Scal-Human
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Collections in the framework are defined in such a way that when enumerating their items, we end up with ... objects.
An example of that is the
PropertyDescriptorCollectionwhich (I am pretty sure of) will never contain anything else than aPropertyDescriptorbut yet we are forced to cast or define the type explicitly.Either those collections should be removed from the framework as they do not bring anything more than troubles, and return
IEnumerable<T>would be more constructive; or they should implement the proper interfaces.PropertyDescriptorCollectionis defined asICollection,IList,IDictionary, this does not make any sense,PropertyDescriptordoes not appear anywhere.Many collections in the framework are like that. I don't know whether this is a required pattern, but if it is, it is wrong.
PropertyDescriptorCollectionshould beICollection<PropertyDescriptor>and when you enumerate it, you getPropertyDescriptorand not an object.All reactions