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.
 
Back
Top