最佳答案
Resharper 有时会警告:
IEnumable 的可能多重枚举
还有 关于如何处理这个问题的问题,ReSharper 网站也解释了 给你的内容。它有一些示例代码告诉您这样做:
IEnumerable<string> names = GetNames().ToList();
我的问题是关于这个具体的建议: 这不会导致在2 for-each 循环中对集合进行两次枚举吗?