为什么我有这个错误,我该如何解决它ASP.NET MVC-不能隐式地将类型'System.Collections.Generic.IEnumerable <>'转换为'System.Collections.Generic.List <System.Tuple <int,string>>
错误9无法隐式转换类型 'System.Collections.Generic.IEnumerable < BPP.CCSP.Admin.Infrastructure.COUNTRIES>' 到“System.Collections.Generic.List < System.Tuple <整型,字符串> >”。存在明确的转换(您是否缺少转换?)C:\ Users \ JKK-HP \ Documents \ Visual Studio 2013 \ Projects \ BPP.CCSP \ BPP.CCSP.Admin.Repository \ Managers \ Concrete \ AdminManager.cs 234 24 BPP.CCSP.Admin.Repository
public List<Tuple<int, string>> getOptionList(string p)
{
if (p == "country")
{
return _countriesRepository.FindAll();
}
}
因为'_countriesRepository.FindAll()'不是'List>类型的类型,所以您需要投射 –
Munzer