找出报告枚举里的 bug

来自 LINQ
C# 14 / .NET 10 进阶 4分钟 找出 1处问题

找出这段生成报表代码中的执行错误。

csharp
using System;
using System.Collections.Generic;
using System.Linq;

IEnumerable<int> orderIds = ReadOrderIds();

Console.WriteLine($"count: {orderIds.Count()}");
Console.WriteLine($"ids: {string.Join(",", orderIds)}");

static IEnumerable<int> ReadOrderIds()
{
    foreach (int id in new[] { 101, 102 })
    {
        Console.WriteLine($"read {id}");
        yield return id;
    }
}
在试验场中打开
报告错误