fork(2) download
  1. using System;
  2. using System.Text;
  3. using System.Linq;
  4. using System.Collections.Generic;
  5.  
  6. public class Program
  7. {
  8.  
  9. public static void Main(string[] args)
  10. {
  11. string[] values = { "1", "2", "3a","4" };
  12. int i = int.MinValue;
  13. List<int> output = values.Where(s => int.TryParse(s, out i))
  14. .Select(s => i)
  15. .ToList();
  16.  
  17. foreach(int num in output)
  18. Console.WriteLine("Number found: " + num);
  19. }
  20. }
Success #stdin #stdout 0.04s 34008KB
stdin
Standard input is empty
stdout
Number found: 1
Number found: 2
Number found: 4