convert memorystream to stream

Use Stream.CopyTo Method(.Net 4 and above)
Eg:
http://msdn.microsoft.com/en-us/library/dd782932.aspx[^]

(.Net 3.5 and before)

public static void CopyStream(Stream input, Stream output)
{
byte[] buffer = new byte[32768];
int read;
while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write (buffer, 0, read);
}
}

manuel11g

Leave a Reply