By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 2,122 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

FileStream to MemoryStream

P: n/a
Hi there,

I need to know what is the fastest way to copy a 9mb FileStream into a
MemoryStream?

Must I read a big buffer then writting it in my MemoryStream or is it a
better way?

Thank you

Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Michel Racicot <mi*********************@cgi.com> wrote:
I need to know what is the fastest way to copy a 9mb FileStream into a
MemoryStream?

Must I read a big buffer then writting it in my MemoryStream or is it a
better way?


Well, I don't know about "big" - a 32K buffer would be plenty, I'd
think. You might get *slightly* faster performance with a larger
buffer, but 32K would be fine.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2

P: n/a
Cor
Hi Michel,

Yes you have to write it in a buffer(a byte array with the size of your
file)

And than construct the memory stream using that byte array

I hope this helps,

Cor
Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.