I have a come across a strange mismatch between documentation and
implementation of the PropertyDescriptorCollection and I wondered if anybody
could help me out:
I would like to implement a class derived from PropertyDescriptorCollection
which fires events whenever a PropertyDescriptorCollection is changed.
The documentation of the PropertyDescriptorCollection class states "The
PropertyDescriptorCollection is read-only; it does not implement methods that
add or remove properties. You must inherit from this class to implement these
methods.".
This seems to be somewhat incorrect on multiple counts:
1. The PropertyDescriptorCollection is actually not read-only if constructed
with "new PropertyDescriptorCollection(new PropertyDescriptor[0] {})" - one
can call Add/Remove etc just fine if the collection is constructed like this.
2 (and more crucial for me). One cannot derive from
PropertyDescriptorCollection and override Add/Remove etc - the functions are
not virtual and cannot be overridden.
Any help is appreciated.
Achim