Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > StringWriter object and dispose method

Reply
Thread Tools

StringWriter object and dispose method

 
 
fabrice
Guest
Posts: n/a
 
      11-14-2006
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

>> Error


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


 
Reply With Quote
 
 
 
 
Dan Bass
Guest
Posts: n/a
 
      11-14-2006

Use Close(). Setting the objec to null stops the object from being
referenced, so the GC will clear it out when it's ready. Note that Dispose
DOES not remove the object from memory.

http://msdn.microsoft.com/msdnmag/issues/1100/gci/



"fabrice" <(E-Mail Removed)> wrote in message
news:Os20oF$(E-Mail Removed)...
> 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
>
>>> Error

>
> 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
>



 
Reply With Quote
 
 
 
 
fabrice
Guest
Posts: n/a
 
      11-14-2006
Great.
Thanks for you help.
have a nice day

"Dan Bass" <na> a écrit dans le message de news:
%23mDFZP$(E-Mail Removed)...
>
> Use Close(). Setting the objec to null stops the object from being
> referenced, so the GC will clear it out when it's ready. Note that Dispose
> DOES not remove the object from memory.
>
> http://msdn.microsoft.com/msdnmag/issues/1100/gci/
>
>
>
> "fabrice" <(E-Mail Removed)> wrote in message
> news:Os20oF$(E-Mail Removed)...
>> 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
>>
>>>> Error

>>
>> 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
>>

>
>



 
Reply With Quote
 
Dan Bass
Guest
Posts: n/a
 
      11-14-2006
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.

"fabrice" <(E-Mail Removed)> wrote in message
news:ewVgTr$(E-Mail Removed)...
> Great.
> Thanks for you help.
> have a nice day
>
> "Dan Bass" <na> a écrit dans le message de news:
> %23mDFZP$(E-Mail Removed)...
>>
>> Use Close(). Setting the objec to null stops the object from being
>> referenced, so the GC will clear it out when it's ready. Note that
>> Dispose DOES not remove the object from memory.
>>
>> http://msdn.microsoft.com/msdnmag/issues/1100/gci/
>>
>>
>>
>> "fabrice" <(E-Mail Removed)> wrote in message
>> news:Os20oF$(E-Mail Removed)...
>>> 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
>>>
>>>>> Error
>>>
>>> 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
>>>

>>
>>

>
>



 
Reply With Quote
 
fabrice
Guest
Posts: n/a
 
      11-15-2006
Thanks Dan.


"Dan Bass" <na> a écrit dans le message de news:
http://www.velocityreviews.com/forums/(E-Mail Removed)...
> 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.
>
> "fabrice" <(E-Mail Removed)> wrote in message
> news:ewVgTr$(E-Mail Removed)...
>> Great.
>> Thanks for you help.
>> have a nice day
>>
>> "Dan Bass" <na> a écrit dans le message de news:
>> %23mDFZP$(E-Mail Removed)...
>>>
>>> Use Close(). Setting the objec to null stops the object from being
>>> referenced, so the GC will clear it out when it's ready. Note that
>>> Dispose DOES not remove the object from memory.
>>>
>>> http://msdn.microsoft.com/msdnmag/issues/1100/gci/
>>>
>>>
>>>
>>> "fabrice" <(E-Mail Removed)> wrote in message
>>> news:Os20oF$(E-Mail Removed)...
>>>> 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
>>>>
>>>>>> Error
>>>>
>>>> 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
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
difference between StringWriter and CharArrayWriter? Tomas Mikula Java 3 11-21-2009 12:56 AM
From StringWriter to InputStream angelochen960@gmail.com Java 6 03-30-2009 05:59 PM
How to use response output with a stringwriter? darrel ASP .Net 3 03-27-2007 07:38 PM
XML XPath and Simple Stringwriter or Streamwriter Question in Datagrid needin4mation@gmail.com ASP .Net 1 06-17-2005 10:03 PM
use of MySQLConnection.dispose and/or MySQLCommand.dispose Antonio Concepcion ASP .Net 3 02-17-2005 06:33 PM



Advertisments