I'm working on solution for a problem which I've solved in C#, but now I'm porting my code to F#. I've got a byte array and I need to search two values (x, y) in this array. When I find x, it needs to be checked: if y is on next index, we have a match. And if y isn't on the next index, the search will continue. How should I solve this problem? I've tried to use Array.findIndex, but without success because I don't know how to continue the search when y is not on next index.
EDIT:
public void GetValue(byte[] data)
{
byte[] temp = new byte[4];
for (int i = 0; i < data.Length; i++)
{
if (data[i] == Adress[0] && data[i + 1] == Adress[1])
{
for (int j = 0; j < temp.Length; j++)
{
temp[j] = data[j + i + 2];
}
Value = BitConverter.ToInt32(temp, 0) * 0.01;
break;
}
}