In addition, if you remove the items from the array using Remove(),
RemoveAt(), or Clear(), then the items are eligeable for garbage collection
as well. But again, this applies, if and only if, there are no other
references to the items.
Pete
"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1b256aecaa01f5c498aa99@msnews.microsoft.c om...[color=blue]
> Sarfraz Hooda <shooda@iqueri.com> wrote:[color=green]
> > I have created an array of Objects in a collection. I was wondering is[/color][/color]
there[color=blue][color=green]
> > a way to destroy the array to free up the space in the memory ? or they[/color][/color]
are[color=blue][color=green]
> > automatically destroyed and garbagge collected by .Net framework?[/color]
>
> When the array is no longer referenced (or is only referenced by things
> eligible for garbage collection) it will become eligible for garbage
> collection.
>
> The references inside the array will become eligible for garbage
> collection when the array does if and only if there are no other
> references to them (which aren't themselves eligible for garbage
> collection).
>
> --
> Jon Skeet - <skeet@pobox.com>
>
http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too[/color]