fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Globalization;
  5.  
  6. public class Test
  7. {
  8.  
  9. public static void Main()
  10. {
  11. var list1 = new List<string>() { "a", "b", "c", "d", "f", "g" };
  12. var list2 = new List<string>() { "b", "d", "f"};
  13.  
  14. var allSameOrder = list1.Intersect(list2).SequenceEqual(list2);
  15. Console.WriteLine("Same order?" + allSameOrder);
  16. list2 = new List<string>() { "d", "b", "f" };
  17.  
  18. allSameOrder = list1.Intersect(list2).SequenceEqual(list2);
  19. Console.WriteLine("Same order?" + allSameOrder);
  20. }
  21. }
Success #stdin #stdout 0.03s 33936KB
stdin
Standard input is empty
stdout
Same order?True
Same order?False