我正在写一个加载项 ReSharper的 4.对于这一点,我需要参考几个ReSharper的的组件。其中一个组件(JetBrains.Platform.ReSharper.Util.dll)包含一个 System.Linq的命名空间,与已经提供的System.Core程序扩展方法的一个子集。
I'm writing an add-in for ReSharper 4. For this, I needed to reference several of ReSharper's assemblies. One of the assemblies (JetBrains.Platform.ReSharper.Util.dll) contains a System.Linq namespace, with a subset of extension methods already provided by System.Core.
当我编辑code,它会创建这些扩展之间的模糊性,使我不能使用排序依据,例如。我怎么能解决这个问题?我想用核心 LINQ 的扩展,而不是那些从ReSharper的。
When I edit the code, it creates an ambiguity between those extensions, so that I cannot use OrderBy, for instance. How could I solve this? I would like to use the core LINQ extensions, and not the ones from ReSharper.
我得到在编译的时候出现以下错误:
I get the following error when trying to compile:
的调用不明确的 以下方法或属性: 'System.Linq.Enumerable.OrderBy<string,int>(System.Collections.Generic.IEnumerable<string>, System.Func&LT;字符串,INT&GT;)和 'System.Linq.Enumerable.OrderBy<string,int>(System.Collections.Generic.IEnumerable<string>, System.Func&LT;字符串,INT&GT; )
The call is ambiguous between the following methods or properties: 'System.Linq.Enumerable.OrderBy<string,int>(System.Collections.Generic.IEnumerable<string>, System.Func<string,int>)' and 'System.Linq.Enumerable.OrderBy<string,int>(System.Collections.Generic.IEnumerable<string>, System.Func<string,int>)'
编辑:我想下面的建议,可惜没有运气。在此期间,我通过删除引用 System.Core程序解决问题。这样一来,我可以使用由ReSharper的DLL文件中提供的扩展。
I tried the suggestion below, unfortunately without luck. In the meanwhile, I "solved" the problem by removing references to System.Core. This way I could use the extensions provided by ReSharper DLL files.
我上传了一个示例程序,我刚刚导入的ReSharper的DLL文件,我需要的。我改变了 System.Core程序的别名 SystemCore ,添加了外部别名指令,但它仍然没有奏效。如果我错过了什么,请让我知道。 附:该引用是在C:\ Program Files文件\ JetBrains的\ ReSharper的\ V4.1 \ ...安装在默认directroy ReSharper的4.1版的DLL文件。
I uploaded a sample program where I just imported the ReSharper DLL files I needed. I changed the alias of System.Core to SystemCore, added the extern alias directive, but it still didn't work. If I missed something, please let me know. P.S. The references are to ReSharper v4.1 DLL files installed in the default directroy in "C:\Program Files\JetBrains\ReSharper\v4.1\...".
推荐答案这不再是一个问题,因为我能够使用LINQ的扩展,由ReSharper的DLL文件的规定,即使是在针对.NET 3.0。
This is no longer an issue, since I am able to use the LINQ extensions, as provided by ReSharper DLL files, even while targeting .NET 3.0.
先生。飞碟双向是正确的了!我可以使用完整的LINQ的语法,而在该项目的属性定位.NET 3.0,而不是引用System.Core程序!
Mr. Skeet was right again! I am able to use full LINQ syntax, while targeting .NET 3.0 in the project's properties and not referencing System.Core!
更多推荐
解决扩展方法/ LINQ歧义
发布评论