Error on “ambigous reference” points to same metho

2019-07-08 20:09发布

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>)'

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.

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

1条回答
啃猪蹄的小仙女
2楼-- · 2019-07-08 20:43

I solved it by moving the class outside of the App_Code directory. Explanation of why can be found here: The call is ambiguous between the following methods or properties (bug??)

查看更多
登录 后发表回答