I have a design, and I'm not sure if garbage collection will occur correctly.
I have some magic apples and some are tasty, some of them are bad.
I have a dictionary: BasketList = Dictionary <basketID,Basket>
(list of baskets).
Each Basket object has one Apple in it, and each Basket stores a reference to the AppleSeperation object.
AppleSeperation stores 2 dictionaries, YummyApples = <basketID,Apple> and BadApples = Dictionary<basketID,Apple> , so when they ask me where I know, I know.
The Apple object stores BasketsImIn = Dictionary<ID,Basket> , which points to the basket both in stores and also to Apple in the basket.
My question is: if I delete the basket from BasketList and make sure that I remove Apple from BadApples and / or YummyApples , will the garbage collection properly, or will there be any dirty links?
garbage-collection collections c #
Vort3x
source share