Convert MemoryStream to FileStream using C #?

I am working on a project that gets a FileStream, and it needs to get it using the method that returns a MemoryStream.

How can I convert a MemoryStream to a FileStream? I can’t touch these codes, and there lies the whole problem.

+3
source share
2 answers

If I understand your question correctly, you have a method that returns a MemoryStream, and you need to pass this stream to a method that accepts a FileStream. I saw several examples when my colleagues wrote methods with the FileStream parameter, when the parameter type could be Stream. This is a great example of why it is better to use a less derived type for the parameter.

, , - : , , , , .

, , .

+2
+1

All Articles