If I create a recursive list of of lists:
class myList
{
List<myList> childLists;
List<string> things;
//...
}
List<myList> tempList = new List<myList>();
And then later call tempList.Clear(), will it destroy all the childLists in memory, or should I create a recursive method to clear all the childLists first?
Best Solution
If no other references exist to the child lists, they will be garbage collected as normal. The trick is to watch for any dangling references to the child items (databinding especially tends to go unnoticed once done).