我这里有一些 Resharper 曲线。
他们告诉我,我正在进行可能的 IEnumerable 多重枚举。然而你可以看到事实并非如此。 final 显式声明为列表 ( List<Point2D>
),pointTangents 先前声明为 List<PointVector2D>
知道为什么 Resharper 可能会告诉我这个吗?
编辑实验以查看是否可以使用更简单的代码进行复制
正如您在下面看到的,即使 Bar 被声明为将 IEnumerable 作为参数,也没有任何波形曲线和警告。
最佳答案
看起来很像RSRP-429474 False-positive warning for possible multiple enumeration :
I have this code:
List<string> duplicateLabelsList = allResourcesLookup.SelectMany(x => x).Select(x => x.LoaderOptions.Label).Duplicates<string, string>().ToList(); ; if (duplicateLabelsList.Any()) throw new DuplicateResourceLoaderLabelsException(duplicateLabelsList);
For both usages of duplicateLabelsList, I'm being warned about possible multiple enumeration, despite the fact I've called ToList and therefore there should be no multiple enumeration.
(当前)有 9.2 的修复版本,(当前)尚未发布。
关于c# - 这是 resharper 中的错误吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30914915/