What is the prefered method for creating a byte array from an input stream?
Here is my current solution with .NET 3.5.
Stream s; byte[] b; using (
You can simply use ToArray() method of MemoryStream class, for ex-
MemoryStream ms = (MemoryStream)dataInStream; byte[] imageBytes = ms.ToArray();