I previously used the following code to find the first occurrence of a text in a string.
int index = myString.IndexOf(“AB”);
Now I will change the software so it will look for first occurrence of the two bytes in a List. Is it possible to do with Linq?
Edit
The program purpose is to communicate via the serial port. Previously the program managed data with a string. But it are strange to handle binary data in a string. So I change the program so that data is handled in a List<byte> instead.
Pure LINQ: