6.2.3 迭代器的执行流程(yield break 语句)
摘要:
static IEnumerable<int> CountWithTimeLimit(DateTime limit){ for (int i = 1; i <= 100; i++) { if (DateTime.Now >= limit) yield break; yield return i; }}static void Main(string[] args){ DateTime stop = DateTime.Now.AddSeconds(2); foreach (int i in CountWithTimeL... 阅读全文
posted @ 2012-05-14 00:13 xiacy 阅读(194) 评论(0) 推荐(0) 编辑