【发布时间】:2011-01-13 02:04:12
【问题描述】:
如果支持,它支持哪些 .NET Framework 版本?
我已经在 .NET Framework 4.0 上对此进行了测试,效果很好:
using System;
using System.Collections.Generic;
public class TestClass
{
public IEnumerable Defer()
{
yield return 1;
yield return 2;
yield return 3;
}
}
【问题讨论】:
-
迭代器(yield 关键字)首先在 C# 版本 2 中可用,随 VS2005 一起提供。
标签: c# ienumerable deferred-execution