fork(10) 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. var strings = new List<String>();
  10. strings.Add("Paul");
  11. strings.Add("Darren");
  12. strings.Add("Joe");
  13. strings.Add("Jane");
  14. strings.Add("Sally");
  15. var firstMatch = strings.FirstOrDefault(s => s.StartsWith("J"));
  16. if(firstMatch != null)
  17. {
  18. Console.WriteLine(firstMatch);
  19. }
  20. }
  21. }
Success #stdin #stdout 0.05s 34096KB
stdin
Standard input is empty
stdout
Joe