System.Array.IndexOf问题
如下代码:
byte[] Test = new byte[] {0x30,0x31,0x0d,0x0a,0x0d,0x0a,0x37};
int TestPos = System.Array.IndexOf(Test, 0x31);
为什么TestPos返回 -1? 我想找到0x31在Test首次出现的位置,哪个地方写错了呢?
------解决方案--------------------
Like this
C# code
byte[] Test = new byte[] { 0x30, 0x31, 0x0d, 0x0a, 0x0d, 0x0a, 0x37 };
int TestPos = System.Array.IndexOf(Test, (byte)0x0d);//2