How to check if a list of integers matches another list of integers in C#?

  • Thread starter Thread starter ElectroBatool
  • Start date Start date
E

ElectroBatool

Guest
I have an integer list of ones and zeros and I would like to check that this this last or a part of it contains the continents of another integer list of ones and zeros in a specific order. Here is the part of my code:

//Declaration of the lists:
List <int> OnesZeros = new List<int>();
List <int> MatchedOnesZeros = new List<int>()
{
0,1,0,1
};


My ultimate goal of this is that when the two lists match in the order of zeros and ones, then lines of code inside an if-statement runs. How can I implement this code?

I tried using List.All, List.TrueForAll, and Lambda expression but they all give syntax errors.

Continue reading...
 
Back
Top