C# – How to convert struct System.Byte byte[] to a System.IO.Stream object in C#

arrayscnetstream

How do I convert struct System.Byte byte[] to a System.IO.Stream object in C#?

Best Answer

The easiest way to convert a byte array to a stream is using the MemoryStream class:

Stream stream = new MemoryStream(byteArray);