C#中的缓冲区BlockCopy
它将字节从一个字节数组复制到另一字节数组。
示例
using System;
class Demo {
static void Main() {
//字节数组
byte[] b1 = new byte[] {55, 66, 77, 88, 99};
byte[] b2 = new byte[8];
//将字节从一个复制到另一个
Buffer.BlockCopy(b1, 0, b2, 0, 5);
/* calling the method with the byte array b2 that has the copied elements */
bufferFunc(b2);
}
static void bufferFunc(byte[] a) {
for (int j = 0; j < a.Length; j++) {
Console.Write(a[j]);
}
Console.WriteLine();
}
}输出结果
5566778899000
热门推荐
4 薛之谦祝福语简短
10 给医生简短新年祝福语
11 英文简短唯美祝福语大全
12 虎年伊始祝福语大全简短
13 毕业祝福语简短英语小学
14 简短正能量生日祝福语
15 新婚祝福语简短十六字
16 哥哥病了祝福语大全简短
17 古风婚礼祝福语唯美简短
18 收到公公生日祝福语简短