FileStream to MemoryStream

  • Thread starter Thread starter Michel Racicot
  • Start date Start date
M

Michel Racicot

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
 
Michel Racicot said:
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.
 
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
 
Back
Top