I am writting a software in Silverlight with C#.
I know that GC.Collect will collect the Objects and Controls if they are non-referenced. But in detail, I am not so sure how is exactly means by non-reference.
I know that in Silverlight, I have to remove the Control (say called "Control A") from the Layout, take out all the event handler, then set the object to null, so it not reference to the object. So something like:
But I mean like...
1) if the "Control A" it contains other Controls: "Control B", "Control C", and they might have subscripted event handler somewhere. Will the "Control A" still get collected by GC.Collect()? And how about "Contorl B" "Control C"? Do I have to actually remove everything that "Control B" and "Control C" that contains and remove "Control B" "Control C" from "Control A" to let them get collected?
2) Say if there is a "Control D" continas a ComboBox, and the ComboBox has a lot ComboxBoxItem. Do I have to Clear() out all the ComboxBoxItem so those ComboxBoxItem will be collected? Or when I remove ComboBox from "Control D", will take out ComboxBoxItem too?
I am kind of confused with Delete in C++, since in C++ I can just delete the whole object with everything it contains...
Thanks