How do I convert byte to stream in C#?
I need to convert a byte array to a Stream . How to do so in C#?
It is in asp.net application.
FileUpload Control Name: taxformUpload
byte buffer = new byte[(int)taxformUpload.FileContent.Length]; taxformUpload.FileContent.Read(buffer, 0, buffer.Length); Stream stream = ConvertToStream(buffer);
This question is tagged with
~ Asked on 2012-03-29 03:28:34
Easy, simply wrap a
MemoryStream around it:
Stream stream = new MemoryStream(buffer);
~ Answered on 2012-03-29 03:30:22
In your case:
MemoryStream ms = new MemoryStream(buffer);
~ Answered on 2012-03-29 03:31:24