c# - 这是 resharper 中的错误吗?

标签 c# resharper ienumerable

我这里有一些 Resharper 曲线。

enter image description here

他们告诉我,我正在进行可能的 IEnumerable 多重枚举。然而你可以看到事实并非如此。 final 显式声明为列表 ( List<Point2D> ),pointTangents 先前声明为 List<PointVector2D>

知道为什么 Resharper 可能会告诉我这个吗?

编辑实验以查看是否可以使用更简单的代码进行复制

正如您在下面看到的,即使 Bar 被声明为将 IEnumerable 作为参数,也没有任何波形曲线和警告。

enter image description here

最佳答案

看起来很像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/

相关文章:

asp.net-mvc-3 - 有什么方法可以让 VS 识别 ReSharper razor 错误并导致编译失败

c# - 在#endregion 处自动创建同名的#region

resharper - ReSharper可以忽略导航中的项目/测试吗

c# - 如何在数据行 [] 的列中找到最大值?

c# - AsParallel() 的最大并行度

c# - 如何更改 DataTable 或 GridView 中日期时间的日期文化?

c# - 使用 MVC 和 Entity Framework 时如何排除模型成为数据库的一部分

c# - 在 C# 中创建一个空的 BitmapSource

c# - 从另一个 IEnumerable 填充任意具体的 IEnumerable

c# - Directory.EnumerateFiles 读取顺序