M
mmurrell
I have a generic dictionary (lets call ChildCollection). I would like
to ensure that whenever a child is added to this collection
(SomeParent.Children.Add(new Child()), the parent of the child object
is set appropriately.
For some reason I would like to understand, the Add method of
System.Collections.Generic.Dictionary<Tkey, TVal> is not virtual. Can
anyone offer some advice on how to accomplish this. I would like to
avoid implementing all methods of the IDictionary<TKey, TVal>
interface, just to append some code to the add method.
Your help is appreciated.
to ensure that whenever a child is added to this collection
(SomeParent.Children.Add(new Child()), the parent of the child object
is set appropriately.
For some reason I would like to understand, the Add method of
System.Collections.Generic.Dictionary<Tkey, TVal> is not virtual. Can
anyone offer some advice on how to accomplish this. I would like to
avoid implementing all methods of the IDictionary<TKey, TVal>
interface, just to append some code to the add method.
Your help is appreciated.