An object is elegible for collection when the GC determines that the object is not reachable anymore. Therefore, the original array can be collected if there is no "usable* reference left to reach it.
When the GC decides to collect the object itself is an alltogether different matter and it is up to the GC to decide; it might very well not collect it at all during the whole lifetime of your app simply because there is no memory pressure that requires it.
Example:
private Blah[] Frob()
{
var someArray = new Blah[] { .... }
//somework
return (Blah[])Array.Resive(someArray, size);
}
In this case, the object referenced bysomeArray will be eligible for collection once Frob returns, because the array is no longer reachable. Its a locally initialized object that can not be reached in any way.
However, in this example:
private Frob[] Foo()
{
var someArray = GetArrayOfFrobs()
//somework
return (Blah[])Array.Resive(someArray, size);
}
The object referenced by someArray will be eligible for collection depending on what GetArrayOfFrobs acutally does. If GetArrayOfFrobs returns an array that is cached somewhere or its part of the state of some other reachable object, then the GC will not mark it as collectible.
In any case, in a managed environment like .NET it’s not methods who decide if a managed object is “freed” or not as you seem to believe based on your question; it’s the GC and it does a pretty good job, so don’t fret about it.