StringWriter object and dispose method

  • Thread starter Thread starter fabrice
  • Start date Start date
F

fabrice

Re hello,

I m' sorry for my questions ..
Under framework 1.1 with vb.net, i m using a StringWriter object to export
in .xls file.
To empty memory, I would like to use the propterty dispose on the object
StringWriter.
But i have received an error like this :

example :

Dim myStringWriter As System.IO.StringWriter = New System.IO.StringWriter
....
myStringWriter.Dispose(System.Boolean)(true)
myStringWriter=Nothing

BC30390: 'System.IO.StringWriter.Protected Overrides Sub Dispose(disposing
As Boolean)' is not accessible in that context. it is protected..


I can use the Close() method but i m not sure that this last one have the
same effects for Garbage Collector ?
Is it possible to use Dispose method with StringWriter object


Thanks for you help
fabrice
 
remember that you also don't need <myObject> = Nothing explicitly in order
for the GC to clean the object up, although it is (IMO) good coding
practice.
 
Thanks Dan.


Dan Bass said:
remember that you also don't need <myObject> = Nothing explicitly in order
for the GC to clean the object up, although it is (IMO) good coding
practice.
 
Back
Top