Created
December 5, 2020 18:45
-
-
Save Atulin/19a16c7b6f4f1e7f19cd9285670e2dde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
public static class VonNeumannExtensions | |
{ | |
public static IEnumerator<int> GetEnumerator(this int number) | |
{ | |
for (var i = 0; i < number; i++) | |
{ | |
yield return i; | |
} | |
} | |
public static IEnumerator<int> GetEnumerator(this Range range) | |
{ | |
for (var i = range.Start.Value; i < range.End.Value; i++) | |
{ | |
yield return i; | |
} | |
} | |
} | |
public static class Program { | |
public static void Main() { | |
foreach (var i in 3..7) { | |
Console.WriteLine(i); | |
} | |
Console.WriteLine("---"); | |
foreach (var i in 7) { | |
Console.WriteLine(i); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 | |
4 | |
5 | |
6 | |
--- | |
0 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 1, | |
"target": "Run", | |
"mode": "Release", | |
"branch": "master" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment