I have a List<Byte> with 10 values (4,6,9,25,64,31,54,15,98,33) and want to get a Byte<List> starting at a specific value/byte for example the value 54 (newbytelist: 54,15,98,33)
List<Byte> values;
List<Byte> newbytelist;
foreach (byte item in values.Skip("from value 54"))
{
newbytelist.Add(item);
}
How can I do that?
You are looking for SkipWhile method:
values.SkipWhile(x => x != 54);
An alternative using Skip would be:
values.Skip(values.IndexOf(54))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With