fork(8) download
  1. using System;
  2. using System.Globalization;
  3. using System.Linq;
  4. using System.Collections.Generic;
  5.  
  6. public class Test
  7. {
  8.  
  9.  
  10. public static void Main()
  11. {
  12. var ListA = new List<int>() { 5, 9, 2, 3, 4, 0, 6 };
  13. var ListB = new List<int>() { 2, 3, 4 };
  14. var containsSameSequence = ListA
  15. .Select((item, index) => ListA.Skip(index).Take(ListB.Count))
  16. .Any(part => part.SequenceEqual(ListB));
  17. Console.Write("Same sequqnce in ListA? " + containsSameSequence);
  18. }
  19. }
Success #stdin #stdout 0.04s 34896KB
stdin
Standard input is empty
stdout
Same sequqnce in ListA? True