C#中如何将字符串转换成流,同时如何将流转换成字符串?

1   string   to   byte  
  string   str   =   "your   string"   ;  
  byte[]   bytes   =   System.Text.Encoding.ASCII.GetBytes(str);  
   
  2   bytes   to   string  
   
  byte[]   bytes   =   new   byte[255]   ;  
  ......  
  string   str   =   System.Text.Encoding.ASCII.GetString(bytes,0,bytes.Length);  
   
  还可以用其他编码     UTF7,UTF8,Unicode   等
posted @ 2007-05-24 15:18  dodo-yufan  阅读(4622)  评论(1编辑  收藏  举报