Convert StringWriter to StringReader

  • Thread starter Thread starter das
  • Start date Start date
D

das

hello all,
might be a dumb one, I have a StringWriter to which I write some
text, after doing this I want to read this into a StringReader so that
I can manipulate the data
ex: while(strRdr.Peek() > -1)
{
// Read data and load into a Physical File - StreamWriter
}

I know that this can be done easily if the text can be written to
FileWriter and then the StringReader reading from the physical file.

But I do not want to create a physical file, I want the Writer to be in
memory, do my text maipulation using StringReader and then create a
physical file.

Is this a totally dumb approach? Please advice.

thanks.
 
das said:
might be a dumb one, I have a StringWriter to which I write some
text, after doing this I want to read this into a StringReader so that
I can manipulate the data

Sure. Use a StringWriter, write the data, then when you're done writing
call new StringReader(stringWriter.ToString()).

-- Barry
 
Thanks Barry!
Wonder why I lack the IntelliGence to check the IntelliSense of
StringReader :)

Adios
 
Back
Top