I have the following code that uses StreamWriter to write to a MemoryStream . However, when I try to read the stream, I get truncated data:
using(var outStream = new MemoryStream()) using (var outWriter = new StreamWriter(outStream)) {
}
This returns most of the data, but truncates toward the end. However, I know that the data gets into the stream, because if I try to write a file instead of a MemoryStream , I get all the contents. For example, this code writes all the contents to a file:
using (var outWriter = new StreamWriter(@"C:\temp\test.out")) {
source share