fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace IEnumなんとかてすと
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. int[] A = new int[16] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
  13.  
  14. foreach (var o in A.SkipEnd())
  15. {
  16. Console.Write("{0} ", o);
  17. }
  18.  
  19. return;
  20.  
  21. }
  22. }
  23.  
  24. public static class ExtFunc
  25. {
  26. public static IEnumerable<T> SkipEnd<T>(this IEnumerable<T> Enumerable)
  27. {
  28. var En = Enumerable.GetEnumerator();
  29. int N = Enumerable.Count();
  30. int i = 0;
  31. while (En.MoveNext())
  32. {
  33. i++;
  34. if (N == i) break;
  35. yield return En.Current;
  36. }
  37. }
  38. }
  39. }
Success #stdin #stdout 0.04s 37080KB
stdin
Standard input is empty
stdout
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14