Cannot step into a method returning IEnumerable?

前端 未结 4 748
没有蜡笔的小新
没有蜡笔的小新 2020-12-15 17:29

I have a method that returns an IEnumerable like this..

public virtual IEnumerable ToPages(){
  // foreach logic
  yield return pages;

  // more         


        
4条回答
  •  时光取名叫无心
    2020-12-15 18:26

    The method isn't run until you enumerate into it.

    foo.ToPages().ToList() // will enumerate and your breakpoint will be hit.
    

提交回复
热议问题