fork(9) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. List<string> a1 = new List<string> { "foo", "bar", "foo" };
  10. List<string> a2 = new List<string> { "bar", "foo", "bar" };
  11.  
  12. IEnumerable<string> inFirstOnly = a1.Except(a2);
  13. IEnumerable<string> inSecondOnly = a2.Except(a1);
  14. bool allInBoth = !inFirstOnly.Any() && !inSecondOnly.Any();
  15.  
  16. Console.WriteLine("allInBoth: " + allInBoth);
  17. }
  18. }
Success #stdin #stdout 0.02s 16916KB
stdin
Standard input is empty
stdout
allInBoth: True