• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 610
  • Last Modified:

Copy Stream object into a MemoryStream object

Hi there

Hope you can help me out?

I have a Stream object and I need to but the whole stream object into a memorystream object, do you guys know how to do this?

I have this

stream = new System.IO.FileStream(fn, System.IO.FileMode.Open, System.IO.FileAccess.Read);

I need to put the whole content into a MemoryStream

Hope this helps?

thanks
0
mousemat24
Asked:
mousemat24
1 Solution
 
mcs0506Commented:
Hi,
You can use
Stream.Write(Byte[] array,Start,Lenght)
to write on Byte array
and then create object
MemoryStream memStream=new MemoryStream(array)

where array is Byte[] array.



Regards

Dani
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now