我想将Argotic写入memorystream,然后将其作为字符串返回给另一个函数。这是我写的:
Stream st = new MemoryStream();
Feed.Save(st); //argotic Save method has the ability to write into Stream
StreamReader sr = new StreamReader(st);
return sr.ReadToEnd();但是我只得到了一个空字符串,虽然st.length显示了正确的长度,但其中没有字符:-?
我该如何解决这个问题?
致以问候。
发布于 2011-06-26 18:04:39
将流的位置重置为0,以便在保存后从头开始读取。否则,您将从当前位置读取,当前位置是流的末尾,因为它刚刚被写入:
st.Position = 0;https://stackoverflow.com/questions/6483303
复制相似问题