Stream To String , String To Stream

        public static string StreamToString(Stream stream)
{
stream.Position = 0;
using (StreamReader stremReader = new StreamReader(stream, Encoding.UTF8))
{
return stremReader.ReadToEnd();
}
} public static Stream StringToStream(string str)
{
byte[] strBytes = Encoding.UTF8.GetBytes(str);
return new MemoryStream(strBytes);
}

  

上一篇:svn清理失败且乱码 问题解决


下一篇:Cow Contest