c#中byte[]和string的转换
1、c#中byte[]和string的转换
http://lfzwenzhu.blog.163.com/blog/static/63693772009112490212/
byte[ ] 转换为string
byte[ ] image;
string ll = Encoding.Default.GetString(image);
结果
- image{维数:[0x00000003]} byte[]
[0x00000000] 0x31 byte
[0x00000001] 0x32 byte
[0x00000002] 0x35 byte
string = "125";
string 转换为byte[ ]
string ss;
byte[] b = Encoding.Default.GetBytes(ss);
结果
string = "125";
- image{维数:[0x00000003]} byte[]
[0x00000000] 0x31 byte
[0x00000001] 0x32 byte
[0x00000002] 0x35 byte
2、string = "31 32 35"->125