What is a MemoryStream and how to use MemoryStream in ASP.NET
The MemoryStream class creates streams that use memory as storage instead of a disk or a network connection. MemoryStream encapsulates data stored as an unsigned byte array that is initialized upon creation of a MemoryStream object, or the array can be created as empty. The encapsulated data is directly accessible in memory. Memory streams can reduce the need for temporary buffers and files in an application.
For more details refer