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