My.Computer.FileSystem.WriteAllText and disposing

  • Thread starter Thread starter kimiraikkonen
  • Start date Start date
K

kimiraikkonen

Hi,
Should i call a kind of dispose or close function after using:

My.Computer.FileSystem.WriteAllText

or

My.Computer.FileSystem.ReadAllText

for next usage in order to leave resources empty / buffer flushing.

I read VB.NET's "using...." statement also closes open resources
"automatically" and shortens syntax for calling any close or dispose
method. Is this also valid for "my.computer.filesystem"?

Thanks
 
kimiraikkonen said:
Should i call a kind of dispose or close function after using:

My.Computer.FileSystem.WriteAllText

or

My.Computer.FileSystem.ReadAllText

for next usage in order to leave resources empty / buffer flushing.

I read VB.NET's "using...." statement also closes open resources
"automatically" and shortens syntax for calling any close or dispose
method. Is this also valid for "my.computer.filesystem"?

No, that's not valid. 'WriteAllText' and 'ReadAllText' will dispose the
resources internally.
 
No, that's not valid. 'WriteAllText' and 'ReadAllText' will dispose the
resources internally.

Sorry, but your answer is not well detailed. So you mean it is not
needed to use any dispose method for my.computer.filesystem?

I read some examples on the net without any dispose / close methods
and also i couldn't find any close / dispose-related functions under
"my.Computer.FileSystem" presented by intelliSense.

Thanks.
 
kimiraikkonen said:
Sorry, but your answer is not well detailed. So you mean it is not
needed to use any dispose method for my.computer.filesystem?

That's what I meant.
 
ReadAllText and WriteAllText are static methods, so there is no instance to
dispose.
 

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