fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace TeraTail35202
  6. {
  7. class Program
  8. {
  9. class Data
  10. {
  11. public string col1;
  12. public int col2;
  13. }
  14.  
  15. static void Main(string[] args)
  16. {
  17. var data = new List<Data>()
  18. {
  19. new Data() { col1 = "AAA", col2 = 1 },
  20. new Data() { col1 = "BBB", col2 = 3 },
  21. new Data() { col1 = "AAA", col2 = 4 },
  22. new Data() { col1 = "CCC" },
  23. new Data() { col1 = "DDD" },
  24. };
  25.  
  26. var searchList = new List<string> { "AAA", "CCC" };
  27.  
  28. var result = data.Where(x => searchList.Contains(x.col1));
  29.  
  30. result.ToList().ForEach(x => Console.WriteLine($"col1 = { x.col1 }, col2 = { x.col2 }"));
  31.  
  32. }
  33. }
  34. }
  35.  
Success #stdin #stdout 0.05s 24000KB
stdin
Standard input is empty
stdout
col1 = AAA, col2 = 1
col1 = AAA, col2 = 4
col1 = CCC, col2 = 0