fork 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> names = new List<string>() { "Jon", "Eric", "Me", "AnotherOne" };
  10. List<string> list = new List<string>() { "Person1", "Paerson2","Eric"};
  11.  
  12. list.RemoveAll(x => !names.Any(y => y == x));
  13. list.ForEach(Console.WriteLine);
  14. }
  15. }
Success #stdin #stdout 0.04s 23944KB
stdin
Standard input is empty
stdout
Eric