I want to write Argotic to memorystream and then return it as a string to another function. and this is what I've written :
Stream st = new MemoryStream();
Feed.Save(st); //argotic Save method has the ability to write into Stream
StreamReader sr = new StreamReader(st);
开发者_如何学JAVAreturn sr.ReadToEnd();
but I only got an empty string although the st.length shows me the correct length but there no character in it :-?
how Can I solve this problem?
regards.
Reset the position of the stream to 0 to read from the beginning, after the save. Otherwise you'll read from the current position, which is the end of the stream since it has just been written to:
st.Position = 0;
精彩评论