Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- class Entry {
- static int Main(string[] args) {
- Console.WriteLine("Hello");
- foreach( int index in 1.To(7) ) {
- Console.WriteLine( index );
- }
- return 0;
- }
- }
- static class Extensions {
- public static IEnumerable<int> To(this int from, int to, int step = 1) {
- to++;
- while (!(step > 0 ^ from < to) && from != to) {
- yield return from;
- from += step;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement