Suppose I have Two Objects:
object1, object2
When I do the following assign:
object2.Foo = object1.Foo; //Edit: where Foo is a reference type
What does the garbage collector do:
- Does it collect object1, while perserving the value assigned to object2.Foo?
- Or, Does object1 persist until object2 is collected because object2.Foo references object1.Foo?
- Or does garbage collection do something completely different, if so please explain?
Thanks!