Re: Streams question



Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx> wrote:
> >Is there a difference between these pieces of code?
>
> have you tried executing them? I think you will fined fileStream is
> already closed.

Let me stick my nose in here. In situations like this, testing is NOT
the right thing to do. There are two reasons for this: (a) the result
is not directly observable, so the test is likely to be inconclusive or
just result in guesses; and (b) there is potentially indeterminate
behavior involved (namely, with the finalizer of the nested stream, if
the outer stream were to discard it but not close it).

Learning by testing is best done when you can write tests that clearly
select between possible results, and where you can trust the results to
be reliable.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
.