Re: ReplacerStream
- From: hvj@xxxxxxxxxx
- Date: Wed, 03 Oct 2007 04:29:37 -0700
To make my self more clear, for instance you should be able to replace
all occurences of "wrongstring" with "rightstring". I think at least
this would requiring buffering, because you can't tell whether you
must replace untill all the bytes of the "wrongstring" have been read.
What I am doing now as a workaround is reading the stream into a
string, do a replace on that string and create a stream again to be
read base on that string. But this is not the most elegant and
performing way:
string _strXml = null;
using (TextReader tr = new StreamReader(stream))
{
_strXml = tr.ReadToEnd();
_strXml = _strXml.Replace(wrongstring,rightstring);
tr.Close();
}
using (StringReader _stringReader = new StringReader(_strXml))
{ etc...
.
- Follow-Ups:
- Re: ReplacerStream
- From: Peter Duniho
- Re: ReplacerStream
- From: hvj
- Re: ReplacerStream
- References:
- ReplacerStream
- From: hvj
- ReplacerStream
- Prev by Date: ReplacerStream
- Next by Date: Updates to .NET Framework 3.0
- Previous by thread: ReplacerStream
- Next by thread: Re: ReplacerStream
- Index(es):
Relevant Pages
|
Loading