摘要: /// /// 图片转成二进制/// /// /// public static byte[] imageWrite(HttpPostedFileUpFile){int FileLength = UpFile.ContentLength;//记录文件长度if (FileLength == 0){//文件长度为零时return null;}else{Byte[] FileByteArray= new Byte[FileLength];//图象文件临时储存Byte数组Stream StreamObject = UpFile.InputStream;//建立数据流对像//读取图象文件数据,Fil.. 阅读全文
posted @ 2014-04-02 10:19 胡狗880601 阅读(310) 评论(0) 推荐(0) 编辑
摘要: string和byte[]的转换 (C#) string类型转成byte[]: byte[] byteArray = System.Text.Encoding.Default.GetBytes ( str );反过来,byte[]转成string:string str = System.Text.Encoding.Default.GetString ( byteArray );其它编码方式的,如System.Text.UTF8Encoding,System.Text.UnicodeEncoding class等;例如:string类型转成ASCII byte[]:("01" 阅读全文
posted @ 2014-04-02 10:18 胡狗880601 阅读(146) 评论(0) 推荐(0) 编辑