Is Yield Return == IEnumerable & IEnumerator?

后端 未结 3 1381
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-31 09:06

Is yield return a shortcut for implementing IEnumerable and IEnumerator?

相关标签:
3条回答
  • 2021-01-31 09:17

    Yes, it is.

    You can find out a lot more about it in chapter 6 of my book, C# in Depth. Fortunately chapter 6 is available for free from Manning's web site.

    I also have two other articles on the book's web site.

    Feedback welcome.

    0 讨论(0)
  • 2021-01-31 09:20

    To add to the link-fest, Raymond Chen did a nice little series on C# iterators a few months ago:

    • http://blogs.msdn.com/oldnewthing/archive/2008/08/12/8849519.aspx
    • http://blogs.msdn.com/oldnewthing/archive/2008/08/13/8854601.aspx
    • http://blogs.msdn.com/oldnewthing/archive/2008/08/14/8862242.aspx
    • http://blogs.msdn.com/oldnewthing/archive/2008/08/15/8868267.aspx
    0 讨论(0)
  • 2021-01-31 09:37

    Yes. See the following for a starter

    http://msdn.microsoft.com/en-us/library/dscyy5s0.aspx

    0 讨论(0)
提交回复
热议问题