HiveBrain v1.2.0
Get Started
← Back to all entries
snippetcsharpCritical

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

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
streamhowstructobjectbyteconvertsystem

Problem

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

Solution

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

Stream stream = new MemoryStream(byteArray);

Code Snippets

Stream stream = new MemoryStream(byteArray);

Context

Stack Overflow Q#4736155, score: 1667

Revisions (0)

No revisions yet.