fork download
  1. using static System.Console;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Program {
  6. public static void Main() {
  7. var lst = new List<string>{"123", "Teste 123 Teste", "ABC", "ABCDE123", "1 2 3" };
  8. var filter = lst.Where(s => s.Contains("123") || s.Contains("ABC")).Take(3).ToList();
  9. foreach (var item in filter) WriteLine(item);
  10. }
  11. }
  12.  
  13. //https://pt.stackoverflow.com/q/134764/101
Success #stdin #stdout 0.03s 17300KB
stdin
Standard input is empty
stdout
123
Teste 123 Teste
ABC