草庐IT

morelinq

全部标签

c# - 如何解决 Enumerable 和 MoreLINQ 之间不明确的 ZIP 调用?

我遇到了扩展方法解析的问题。LINQ和MoreLINQ包含zip方法,它自4.0版本以来就存在于.NET中,并且始终在MoreLINQ中。图书馆。但是您不能使用带有旧式扩展方法语法的实现之一。所以这段代码不会编译usingMoreLinq;usingSystem.Linq;varstudents=new[]{"Mark","Bob","David"};varcolors=new[]{"Pink","Red","Blue"};students.Zip(colors,(s,c)=>s+c);错误:Thecallisambiguousbetweenthefollowingmethodsorp