fork(14) download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace ConsoleApp1
  5. {
  6. static class MyLinq
  7. {
  8. public static IEnumerable<int> Where(this int[] arr, Func<int, bool> cond)
  9. {
  10. return new int[] { 2, 4, 6, 8 };
  11. }
  12. }
  13.  
  14. class Program
  15. {
  16. static void Main(string[] args)
  17. {
  18. int[] arr = { 1, 2, 3, 4, 5, 6, 7, 8 };
  19. var query = from x in arr where x % 2 == 0 select x;
  20. foreach (int x in query) Console.Write(x + "\t");
  21. }
  22. }
  23. }
  24.  
Success #stdin #stdout 0.02s 14744KB
stdin
Standard input is empty
stdout
2	4	6	8