Created
March 28, 2020 22:53
-
-
Save TheFo2sh/507b2a7e08c26c508a7f2da3ef7bcbdd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| public class Generator<T> : IEnumerable<T> | |
| { | |
| private GeneratorEnumerator<T> _generatorEnumerator; | |
| public Generator(Func<int, T> generatorFunc) | |
| { | |
| _generatorEnumerator = new GeneratorEnumerator<T>(generatorFunc); | |
| } | |
| public IEnumerator<T> GetEnumerator() | |
| { | |
| return _generatorEnumerator; | |
| } | |
| IEnumerator IEnumerable.GetEnumerator() | |
| { | |
| return GetEnumerator(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment