I'm not aware of any built-in way; as per usual, you can always write your own extension method. Here's one off the top of my head (there may be more efficient ways to implement it):
public static IEnumerable<T> AfterSequence<T>(this IEnumerable<T> source,
T[] sequence)
{
bool sequenceFound = false;
Queue<T> currentSequence = new Queue<T>(sequence.Length);
foreach (T item in source)
{
if (sequenceFound)
{
yield return item;
}
else
{
currentSequence.Enqueue(item);
if (currentSequence.Count < sequence.Length)
continue;
if (currentSequence.Count > sequence.Length)
currentSequence.Dequeue();
if (currentSequence.SequenceEqual(sequence))
sequenceFound = true;
}
}
}
I'll have to check to make sure that this is correct, but it should give you the basic idea; iterate through the elements, track the last sequence of values retrieved, set a flag when the sequence is found, and once the flag is set, start returning each subsequent element.
Edit - I did run a test, and it does work correctly. Here's some test code:
static void Main(string[] args)
{
byte[] data = new byte[]
{
0x01, 0x02, 0x03, 0x04, 0x05,
0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA
};
byte[] sequence = new byte[] { 0x02, 0x03, 0x04, 0x05 };
foreach (byte b in data.AfterSequence(sequence))
{
Console.WriteLine(b);
}
Console.ReadLine();
}