Simple Use IEnumerable

时间:2022-10-31 01:15:44

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(...)

  }

}