TextWriter

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I need to us a TextWriter as an argument of a method:

System.IO.TextWriter t;
_parser.Go(t);

However I get, on the second line, the error:
Use of unassigned local variable 't'

But I am not able to do the following:
System.IO.TextWriter t = new TextWriter();

How can I solve this?

Thanks,
Miguel
 
Hello,

I need to us a TextWriter as an argument of a method:

System.IO.TextWriter t;
_parser.Go(t);

However I get, on the second line, the error:
Use of unassigned local variable 't'

But I am not able to do the following:
System.IO.TextWriter t = new TextWriter();

How can I solve this?

Thanks,
Miguel


TextWriter is an abstract class so you can't instantiate it. You must
use one of the derived classes such as StreamWriter and StringWriter.

http://msdn.microsoft.com/en-us/library/system.io.textwriter.aspx
 
Hello,

I need to us a TextWriter as an argument of a method:

System.IO.TextWriter t;
_parser.Go(t);

However I get, on the second line, the error:
Use of unassigned local variable 't'

But I am not able to do the following:
System.IO.TextWriter t = new TextWriter();

How can I solve this?

Thanks,
Miguel

TextWriter is abstract. You can use StreamWriter, or some other class
that extends TextWriter.
 
I need to us a TextWriter as an argument of a method:

System.IO.TextWriter t;
_parser.Go(t);

However I get, on the second line, the error:
Use of unassigned local variable 't'

But I am not able to do the following:
System.IO.TextWriter t = new TextWriter();

RTFM. TextWriter is abstract; you can't create instances of it. Create a
StreamWriter.
 
Reading The Fantastic Manual may be a good idea, indeed. :)

Hmmm, not sure if I'd use "fantastic" in reference to MSDN. "Helpful,"
usually, but RTHM is just silly. Is there a synonym for "dry" that starts
with F...?
 
Hmmm, not sure if I'd use "fantastic" in reference to MSDN. "Helpful,"
usually, but RTHM is just silly. Is there a synonym for "dry" that starts
with F...?

Well now, let's not spill the obvious truth so soon -- Where's the fun
in that? For us, who have done quite some reading on MSDN, I am sure
most of us have felt a little left out on information among other
things. Those who are new to MSDN will find out sooner or later. So you
understand "Read The Fantastic Manual" now, right?
Well, some people just want to pick on something but I'm sure weren't
trying to do that. :)
 
Back
Top