disposing of string array

  • Thread starter Thread starter Aaron Irizarry
  • Start date Start date
A

Aaron Irizarry

How can I dispose of a string array?
I create it with:
lines = new string[3]; //the declaration's somewhere else

but now I'd like to dispose of its contents so I can create it again with a
new size.

Thanks.
 
Removing your reference to it will make it eligible for GC. Simply

lines = null;
lines = new string[5];
or letting lines fall out of scope

Any of the above will remove that reference to the string array. The second
one will create a new array with a new size.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top