Hello everyone,


Two questions about the following code,

1. When instance of Class1 is put to GC queue, its wrapped Obj instance is 100% ensured to move to GC queue, but the order of whether the memory and Finalize method of Class1 instance or obj1 instance will be called first can not be decided (GC may make different decision in different situations)?

2. If some instance does not hold the reference of Class1, but holds the reference to obj1 through public method PassOut, in this situation, Class1 instance is prevent from being GCed?

Code:
using System;

/// <summary>
/// Summary description for Class1
/// </summary>
public class Class1
{
    private Component Obj = new Component();

    public Component PassOut()
    {
        return Obj;
    }

    public Class1()
	{
        //
		// TODO: Add constructor logic here
		//
	}
}

thanks in advance,
George