日期:2014-05-18 浏览次数:20974 次
//byte[] bytes; int n = 0x56789ABC; bool found = false; for (int i = 0; i < bytes.Length - 4; i += 4) { if (BitConverter.ToInt32(bytes, i) == n) { found = true; break; } }
------解决方案--------------------
我想在里面找0xFFD8这个十六进制数
short s = 0xFFD8;
for (int i = 0; i < bytes.Length - 2; i += 2)
{
if (BitConverter.ToInt16(bytes, i) == s)
...