c# 流,字节数组及字符串之间的转换
//1.流转换为字节数组,fileUpload为.net上传控件
Stream stream = fileUpload.FileContent;
byte[] fileBuffer = new byte[stream.Length];
stream.Read(fileBuffer,0,(int)stream.Length);
//2.字节数组转换为字符串
string fileBody = System.Text.Encoding.Default.GetString(fileBuffer);
//3.字符串转换为字节数组
string key = "******* key";
byte[] buffer = System.Text.Encoding.Default.GetBytes(key);