Simple Use IEnumerable<T>

Private static IEnumerable<T> FunDemo(T para)

{

  while(...)

    {

      ....

      yield return Obj;

    }

}

static main(arg[] arg)

{

  IEnumerable<T> list=FunDemo(para);

  foreach(var m in list)

  {

    Console.WriteLine("The No. "+IndexOf(m));

    do{

      Console.WriteLine(....);

    }while(...)

  }

}

原文地址:https://www.cnblogs.com/Javi/p/7613924.html