TextWriter

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
 
J

Jackie

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
 
F

Family Tree Mike

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

Jeff Johnson

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

Jeff Johnson

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...?
 
J

Jackie

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. :)
 

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

Similar Threads


Top