Wrapping a Collection Class
Bing wrote:
i was going to wrap the Collection and override the Add method to
remove the key from collection than delegate to the actual collection
itself to perform the add but doesn't seem to be as straight forward
as initially thought without writing lots of code to check for which
option was/wasn't specified in the new Add method before delegating
it to the actual Collection.
One way would be to make the Key argument mandatory or use a default,
making the Before and After arguments irrelevant. My collection classes
are always for object's, rather than values, so this is easy for me: I
either default to the object's Name property or use its ObjPtr() value
as appropriate. This makes the Remove method very easy i.e. use the Key
to remove the object. That said, I rarely use the remove method: easier
to start over using a new collection class instance.
Jamie.
--
|