c#将字符串写入Sream中

MemoryStream memoryStream = new MemoryStream();  //创建其支持存储区为内存的流。
UnicodeEncoding uniEncoding = new UnicodeEncoding();  

string str = "helloworld";  //要存入的字符串

byte[] string1 = uniEncoding.GetBytes(str);  //转化为字节

memoryStream.Write(string1 , 0, string1 .Length);  //写入流

 

posted @ 2013-10-28 17:38  zhushang  阅读(733)  评论(0编辑  收藏  举报