I don\'t understand what I\'m doing wrong here. I generate couple of memory streams and in debug-mode I see that they are populated. But when I try to copy MemoryStrea
If your objective is simply to dump the memory stream to a physical file (e.g. to look at the contents) - it can be done in one move:
System.IO.File.WriteAllBytes(@"C:\\filename", memoryStream.ToArray());
No need to set the stream position first either, since the .ToArray() operation explicitly ignores that, as per @BaconBits comment below https://docs.microsoft.com/en-us/dotnet/api/system.io.memorystream.toarray?view=netframework-4.7.2.