Rupert

::Me(C#,VC,MonoTouch,MonoforAndroid);

导航

2013年2月1日

摘要: .byte[] head = new byte[] { 0x7e }; .byte[] type = new byte[] { 0x00 }; .byte[] content = Encoding.Default.GetBytes("ABCDEGF"); .byte[] last = new byte[] { 0x23 }; .byte[] full=new byte[head.Length+type.Length+content.Length+last.Length]; .//head.CopyTo(full,0); .//type.CopyTo(full, head.L 阅读全文

posted @ 2013-02-01 17:04 ArRan 阅读(279) 评论(0) 推荐(0) 编辑

摘要: 如果还想从 System.String 类中找到方法进行字符串和字节数组之间的转换,恐怕你会失望了。为了进行这样的转换,我们不得不借助另一个类:System.Text.Encoding。该类提供了 bye[] GetBytes(string) 方法将字符串转换成字节数组,还提供了 string GetString(byte[]) 方法将C#字节数组转换成字符串。System.Text.Encoding 类似乎没有可用的构造函数,但我们可以找到几个默认的 Encoding,即 Encoding.Default(获取系统的当前 ANSI 代码页的编码)、Encoding.ASCII(获取 7 位 阅读全文

posted @ 2013-02-01 14:03 ArRan 阅读(315) 评论(0) 推荐(0) 编辑