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
mousemat24Asked:
Who is Participating?
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.