php - .NET 中 PHP 的 InfiniteIterator 的等效项是什么?

标签 php .net equivalent

我讨论了 PHP 的 InfiniteIterator与 friend 。

在 .NET 世界中是否有类似的东西?

最佳答案

不是内置的但易于编写:

public static IEnumerable<T> RepeatInfinitely<T>(this IEnumerable<T> sequence)
{
 while(true) {
  foreach(var item in sequence)
   yield return item;
 }
}

关于php - .NET 中 PHP 的 InfiniteIterator 的等效项是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10219939/

相关文章:

php - php 中的 "->"是否与 javascript 中的 "."相似(也称为等效)?

php - 输入按钮/ anchor 链接提交表单,其中指定了 POST 的 GET

c# - 自定义 JsonConverter 在不应该使用 TokenType "EndObject"的情况下获取阅读器

c# - Q : What is the best way to store api keys in a Blazor WASM application?

相当于 SwingUtilities.invokeLater() 的 JavaScript

c# - 在 C# ASP.NET 中,Java 中的同步块(synchronized block)等效于什么?

php - mysql 插入...选择

javascript - 使用 php 与 Ajax 实现响应式 UI

c# - 创建可以通过在背景区域中的任意位置拖动来移动的非矩形表单

mysql - 此 mysql 查询的 SQL Server 等效项?