fork download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. List<string> items= new List<string>();
  10. items.Add("Item3");
  11.  
  12. var Order = new [] {
  13. new { Products = "Item1,Item3,Item4" },
  14. new { Products = "Item3,Item5,Item6" },
  15. new { Products = "Item2,Item7,Item6" },
  16. new { Products = "Item1,Item2" },
  17. new { Products = "Item1" },
  18. };
  19.  
  20. var results = (from o in Order
  21. .Where(o => items.Any(i => (","+o.Products+",").Contains(","+i+",")))
  22. select o
  23. );
  24.  
  25. foreach (var i in results)
  26. Console.WriteLine(i.Products);
  27. }
  28. }
Success #stdin #stdout 0.05s 34128KB
stdin
Standard input is empty
stdout
Item1,Item3,Item4
Item3,Item5,Item6