I have a design and I am not sure if garbage collection will occur correctly.
I have some magic apples, and some are yummy some are bad.
I have a dictionary : BasketList = Dictionary <basketID,Basket>
(list of baskets).
Each Basket
object has a single Apple
in it and each Basket
stores a reference to an objectAppleSeperation
.AppleSeperation
stores 2 dictionaries, YummyApples = <basketID,Apple>
and BadApples = Dictionary<basketID,Apple>
, so when I'm asked where an apple is I know.
An Apple
object stores BasketsImIn = Dictionary<ID,Basket>
, which points to the Basket and in Shops, and the Apple in Basket.
My question is, if I delete a basket from BasketList
and make sure I delete the Apple from BadApples
and/or YummyApples
, will garbage collection happen properly, or will there be some messy references lying around?