【发布时间】:2019-01-04 20:41:36
【问题描述】:
有类似的问题 - 但到目前为止,他们都没有帮助。
我在打电话:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
然后在我的一段代码中,VS 指出了 LINQ 方法(.Last() 和 .Max())中的错误。我将鼠标悬停在 .Max() 上。错误说:
以下方法或属性之间的调用不明确:'System.Linq.Enumerable.Max(System.Collections.Generic.IEnumerable
)' 和 'System.Linq.Enumerable.Max(System.Collections.Generic .IEnumerable )'
我已经尝试重新安装我所有的引用和包,我重新启动了 VS、IIS(这是一个网站)。 VS 识别 System.Linq 所以这不是问题....
我不明白为什么这是突然抛出的错误。
【问题讨论】:
-
您似乎有两个不同的
System.Linq.Enumerable候选人。 -
这怎么可能?我认为 VS 会阻止您添加相同的引用
-
它不必是相同的引用。有人过于聪明并实施
System.Linq.Enumerable就足够了。 -
我应该如何寻找这个额外的参考?
-
您可以尝试reference the System.Linq namespace from a specific assembly 看看是否可以解决问题。
标签: c# linq collections