Any idea how I can find a byte array inside a byte array?
Example
byte[] array1 = { 101, 21, 92, 1, 92, 0, 132, 0, 22 }
byte[] search = { 21, 92 }
so use array search and find it inside array1 then extract x amount of bytes after the search array up until specific bytes are reached such as,
0, 132, 0, 22
Extraction for example would be in this scenario
1, 92
from array1
byte[] array1 = { 101, 21, 92, 1, 92, 0, 132, 21, 0, 22 };
byte[] search = { 21, 92 };
var data = search.Where(a => array1.Contains(a)).ToList();
foreach (var item in data)
{
Console.WriteLine(item);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.