fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Test
  6. {
  7. public static IEnumerable<int> Tester()
  8. {
  9. yield return 1;
  10. yield return 2;
  11. throw new Exception();
  12. }
  13.  
  14. static void Main(string[] args)
  15. {
  16. Console.WriteLine(Tester().Any(x => x == 1));
  17. Console.WriteLine(Tester().Any(x => x == 2));
  18.  
  19. try
  20. {
  21. Console.WriteLine(Tester().Any(x => x == 3));
  22. }
  23. catch
  24. {
  25. Console.WriteLine("Error here");
  26. }
  27. }
  28. }
Success #stdin #stdout 0.03s 24120KB
stdin
Standard input is empty
stdout
True
True
Error here