System.IO.TextWriter vs System.IO.TextWriter

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

What is the difference between System.IO.TextWriter vs System.IO.TextWriter?

Thanks

Regards
 
Hi

What is the difference between System.IO.TextWriter vs System.IO.TextWriter?

Thanks

Regards

Difference? Which difference? They're same.Or you meant StreamWriter?
 
John said:
Sorry, just slapped myself..Yes System.IO.StreamWriter.

'StreamWriter' inherits from 'TextWriter' and extends it. Note that you
cannot instantiate 'TextWriter' because it is marked as 'MustInherit'.
 
'StreamWriter' inherits from 'TextWriter' and extends it. Note that you
cannot instantiate 'TextWriter' because it is marked as 'MustInherit'.

IMHO, another point about being extended of StreamWriter/Reader,
that's compatible with "Using" statement which performs automatic
dispose / close methods. If you use TextWriter/Reader you must
explicitly use close / dispose method.

Regards,

Onur Güzel
 
kimiraikkonen said:
IMHO, another point about being extended of StreamWriter/Reader,
that's compatible with "Using" statement which performs automatic
dispose / close methods. If you use TextWriter/Reader you must
explicitly use close / dispose method.

How would you use 'TextReader' if it cannot even be instantiated?
 
How would you use 'TextReader' if it cannot even be instantiated?

Just wanted to point out "Using" statement is used with StreamWriter
not with TextWriter, but i can be wrong, sorry.
 

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