在&QUOT错误; ambigous参考"指向同样的方法两次 [英] Error on "ambigous reference" points to same method twice

查看:202
本文介绍了在&QUOT错误; ambigous参考"指向同样的方法两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用<一个href="http://stackoverflow.com/questions/3509290/how-to-convert-a-linq-result-to-datatable/3767520#3767520">this辉煌的解决方案以LINQ查询转换为数据表。但我运行时,它得到一个奇怪的错误。构建成功,虽然。

I used this brilliant solution to convert a linq query to a datatable. But I'm getting a strange error when running it. Build succeeds though.

Compiler Error Message: CS0121: The call is ambiguous between the following methods or properties:
'Gruppkoll.App_Code.ConvertToDataTableFromLinqResult.ToADOTable<Gruppkoll.MessageSet
    (System.Collections.Generic.IEnumerable<Gruppkoll.MessageSet>)' and
'Gruppkoll.App_Code.ConvertToDataTableFromLinqResult.ToADOTable<Gruppkoll.MessageSet
    (System.Collections.Generic.IEnumerable<Gruppkoll.MessageSet>)'

我已经试过重新构建它并重新启动IIS。它似乎有两班用同样的方法,但我已经检查这一点,事实并非如此。

I've tried re-building it and restarting the IIS. It seems as there are two classes with the same method but I've checked this and that's not the case.

任何想法?我使用.NET 4.0 ASP.NET Web表单

Any ideas? I'm using .NET 4.0 ASP.NET Webforms

推荐答案

我通过移动类APP_ code目录以外的解决了这个问题。为什么可以在这里找到解释:<一href="http://stackoverflow.com/questions/1282636/the-call-is-ambiguous-between-the-following-methods-or-properties-bug">http://stackoverflow.com/questions/1282636/the-call-is-ambiguous-between-the-following-methods-or-properties-bug

I solved it by moving the class outside of the App_Code directory. Explanation of why can be found here: http://stackoverflow.com/questions/1282636/the-call-is-ambiguous-between-the-following-methods-or-properties-bug

这篇关于在&QUOT错误; ambigous参考&QUOT;指向同样的方法两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆