Skip to content

Instantly share code, notes, and snippets.

@shadeglare
Last active December 22, 2015 00:09
Show Gist options
  • Save shadeglare/6387242 to your computer and use it in GitHub Desktop.
Save shadeglare/6387242 to your computer and use it in GitHub Desktop.
Yield Flaw
IEnumerable<SomeClass> SomeMethod1() {
yield return new SomeClass();
yield return new SomeClass();
foreach (var elem in SomeMethod2()) {
yield return elem;
}
}
IEnumerable<SomeClass> SomeMethod2() {
yield return new SomeClass();
yield return new SomeClass();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment