(61)C# 可枚举类型和迭代器

 一、可枚举类型

枚举器-Enumerator  是一个只读且只能在值序列向前移动的游标

枚举器需要实现下列接口之一

 

   System.Collections.IEnumerator
   System.Collections.Generic.IEnumerator<>

 

他拥有

Current和MoveNext方法

 

二、迭代器

 

yield return xxx: 

yield break;

 

posted @ 2019-11-05 10:53  富坚老贼  阅读(203)  评论(0)    收藏  举报