C# byte 数组合并
2011-03-15 10:23
197 查看
01.byte[] head = new byte[] { 0x7e }; 02.byte[] type = new byte[] { 0x00 }; 03.byte[] content = Encoding.Default.GetBytes("ABCDEGF"); 04.byte[] last = new byte[] { 0x23 }; 05.byte[] full=new byte[head.Length+type.Length+content.Length+last.Length]; 06.//head.CopyTo(full,0); 07.//type.CopyTo(full, head.Length); 08.//content.CopyTo(full,head.Length+type.Length); 09.//last.CopyTo(full, head.Length + type.Length + content.Length); 10.Stream s = new MemoryStream(); 11.s.Write(head, 0, 1); 12.s.Write(type,0,1); 13.s.Write(content,0,content.Length); 14.s.Write(last, 0, 1); 15.s.Position = 0; 16.int r = s.Read(full, 0, full.Length); 17.if (r>0) 18.{ 19. Console.WriteLine(Encoding.Default.GetString(full)); 20. Console.WriteLine(full.Length); 21. Console.WriteLine(full[0].ToString()); 22. Console.WriteLine(full[1].ToString()); 23. Console.WriteLine(full[9].ToString()); 24. Console.Read(); 25.}
相关文章推荐
- C# byte 数组合并(转载)
- C# byte 数组合并
- C#byte数组合并
- c# 合并byte数组
- 关于在C#中数组(byte[])复制方式
- 合并byte[]字节数组
- C#用byte[]字节数组获取C中byte*指针
- C# string byte数组转换解析
- 请教一个C#中将byte[]数组转换为Image的问题
- c#中文字符串与byte数组互相转化
- c# byte数组转存本地图片
- C# 字符串string和内存流MemoryStream及比特数组byte[]之间相互转换
- C#下byte数组与string的相互转换
- C# byte数组转换string类型如何去掉结束符
- c# Buffer.BlockCopy 合并 byte 数组
- 数组byte[]合并与讨论
- C# Byte[]数组读取和写入文件
- 使用C#将文件以Byte数组的形式读入内存
- C#中结构体和byte数组的转化
- c#中字节数组byte[]、图片image、流stream,字符串string、内存流MemoryStream、文件file,之间的转换