fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5.  
  6. namespace Enum
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. List<string> S = new List<string>() { "alan.foo", "bob.htm", "dave.tea", "other.yuy" };
  13. List<string> X = new List<string>() { ".foo", ".htm", ".tea" };
  14.  
  15. var newlist = S.Where(x => X.Any(y => x.EndsWith(y)));
  16.  
  17. foreach (var item in newlist)
  18. {
  19. Console.WriteLine(item);
  20. }
  21. }
  22. }
  23. }
  24.  
Success #stdin #stdout 0.06s 34088KB
stdin
Standard input is empty
stdout
alan.foo
bob.htm
dave.tea