Hi
i have a class (Item) and a typed collection
(ItemCollection:CollectionBase).
Each Item can have Sub-Items and each Item has a Reference to his
"Parent Item".
in brief:
public class Item
{
private ItemCollection subItems=new ItemCollection();
private Item parentItem = null;
public void AddSubItem(Item subItem)
{
subItem.ParentItem = this;
this.subItems.Add(subItem);
}
}
A "Structure starts" with a main-Item, adding SubItems, Sub-Sub-Items,
Sub-Sub-Sub-Items e.g. reading Data from Database or file).
public class Viewer
{
public void View()
{
Item mainItem = new Item();
// ... adding sub, sub-sub, ..... items
// do smth. with mainItem
}
}
Now my Question: can garbage collection remove mainItem, all sub-Items
and collections automaticly
should I do smth. special at the end ov Viewer.View() (beacuse of the
parent ref.), eg. setting alle "Parent-References" manually to null...
thank you
Peter.