Re: how to dispose of a streamwriter without closing the underlying stream
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Wed, 10 Dec 2008 11:13:33 -0800
On Wed, 10 Dec 2008 01:48:10 -0800, <ajfish@xxxxxxxxxxxxxxxx> wrote:
Thanks for all the responses. I think peter's solution is a good way
to go. I'm just curious as to why MS couldn't have put some kind of
property on the StreamWriter to affect whether it closes the
underlying stream.
You'd have to ask Microsoft. But, as you can see from these related discussions, what and how exactly to do that is not without complications. The reader/writer classes are dependent on encoding and exact byte position, and there's no way to ensure that a reader in particular hasn't read some bytes that are actually part of a different encoding (for streams that mix encodings or even non-text data).
I would guess that since there's not really any reliable way to generalize that kind of functionality, the framework leaves it up to the application to do it, under its full control so that any mistakes in dealing with the mixed data stream are the fault of the application, not the framework. :)
Pete
.
- References:
- Prev by Date: Validate DateTime
- Next by Date: Re: debugging a service
- Previous by thread: Re: how to dispose of a streamwriter without closing the underlying stream
- Next by thread: Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBoxMode'
- Index(es):
Relevant Pages
|