fork download
  1. public static IEnumerable<T> SkipEnd<T>(this IEnumerable<T> enumerable, int count) {
  2. T[] cache = new T[count];
  3. var ie = enumerable.GetEnumerator();
  4. for (int i = 0; i < count; ++i) {
  5. if (!ie.MoveNext()) {
  6. yield break;
  7. }
  8. cache[i] = ie.Current;
  9. }
  10. int index = 0;
  11. while (ie.MoveNext()) {
  12. yield return cache[index];
  13. cache[index] = ie.Current;
  14. if (++index >= count) {
  15. index = 0;
  16. }
  17. }
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(1,30): error CS0116: A namespace can only contain types and namespace declarations
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty