任何人都知道在byte[]数组中搜索/匹配字节模式然后返回位置的好而有效的方法。例如byte[]pattern=newbyte[]{12,3,5,76,8,0,6,125};byte[]toBeSearched=newbyte[]{23,36,43,76,125,56,34,234,12,3,5,76,8,0,6,125,234,56,211,122,22,4,7,89,76,64,12,3,5,76,8,0,6,125} 最佳答案 我可以建议一些不涉及创建字符串、复制数组或不安全代码的东西吗:usingSystem;usingSy
我在网上找到了如下代码:privatebyte[]StreamFile(stringfilename){FileStreamfs=newFileStream(filename,FileMode.Open,FileAccess.Read);//Createabytearrayoffilestreamlengthbyte[]ImageData=newbyte[fs.Length];//Readblockofbytesfromstreamintothebytearrayfs.Read(ImageData,0,System.Convert.ToInt32(fs.Length));//Close