相关疑难解决方法(0)

"收益率回报"概念的名称是什么?IEnumerable,Iterator,Generator?

这个yield return概念的官方名称究竟是什么?

public IEnumerable<T> Bar() {
    ...
    yield return foo;
    ...
}
Run Code Online (Sandbox Code Playgroud)

我听说(读)它被称为:

  • 迭代器
  • IEnumerabe
  • 发电机
  • <您的选择>

迭代器不只是迭代某些东西的"东西"吗?A List<T> 一个IEnumerable<T>,所以似乎也不合理.

这里有很多答案,谈论yield return使用这两个术语中的一个.

那么"发电机"怎么样?或者这只适用于你"凭空捏造价值",例如你不需要数据收集作为来源的Fibonacci数字?

c# ienumerable yield terminology

1
推荐指数
1
解决办法
348
查看次数

标签 统计

c# ×1

ienumerable ×1

terminology ×1

yield ×1