I have a line of code like this:
var results = new GroupedCountsModel { XAxis = entities.ListGroupKeys(fieldNameX) };
When I try to compile this code, I get a build error:
The call is ambiguous between the following methods or properties:
'MyProject.Shared.QueryGeneration.GroupByHelper.ListGroupKeys<TEntity>(System.Linq.IQueryable<TEntity>, string)'
and
'MyProject.Shared.QueryGeneration.GroupByHelper.ListGroupKeys<TEntity>(System.Linq.IQueryable<TEntity>, string)'
C:\{mypath}\MyProject.Shared\Controllers\BaseEntityController.cs
This is interesting because the two methods listed in the error are exactly the same. This is not like I have the same method signature defined in a different namespace or assembly. I donβt know why the compiler thinks they are different when the compiler itself points to the same method twice. Here is the method:
public static class GroupByHelper
{
public static List<object> ListGroupKeys<TEntity>(this IQueryable<TEntity> source, string fieldName)
where TEntity : class, IDataEntity
{
}
}
What could be the reason for this? How can I fix this problem?
source
share