fork download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. public class Test
  6. {
  7. private static List<string> Col1 = new List<string>
  8. {
  9. "Foo",
  10. "Bar",
  11. "Foobar",
  12. "Barfoo",
  13. };
  14.  
  15. private static List<string> Col2 = new List<string>
  16. {
  17. "Foo",
  18. "Bar",
  19. };
  20.  
  21. public static void Main()
  22. {
  23. Console.WriteLine(Col1.Where(e => GetCol2().Any(e2 => e2 == e)).Count().ToString());
  24. }
  25.  
  26. private static List<string> GetCol2()
  27. {
  28. Console.WriteLine("test");
  29. return Col2;
  30. }
  31. }
Success #stdin #stdout 0.02s 17068KB
stdin
Standard input is empty
stdout
test
test
test
test
2