gpt4 book ai didi

c# - ForEach——你在哪里?

转载 作者:行者123 更新时间:2023-11-30 21:13:47 24 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Why is there not a ForEach extension method on the IEnumerable interface?

我喜欢 C# 中 List 的 .ForEach 方法。这怎么不是 IEnumerable 上的扩展方法套件之一?

为什么我必须调用 .ToList() 我的集合才能对每个元素调用一个操作?请告诉我为什么?谢谢。

List<T>.ForEach(Action<T> action);

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com